Are you first timer at lazacode.org? Why not join us and start exchange your programming knowledge with everyone. Register today!

jQuery .mousedown on HTML input or attribute

0 votes
149 views
added Sep 20, 2018 in jQuery by LC Marshal Captain (26,090 points)
edited Jul 17, 2019 by LC Marshal
var icNumber = $('input#edit-profile-basic-field-ic-und-0-value');

$(icNumber).val('e.g 888888888888').attr('maxlength', 12);
$(icNumber).mousedown(function(){
    $(this).val('');
    console.log( 'pressed');
});

 

1 Response

0 votes
responded Jul 17, 2019 by LC Marshal Captain (26,090 points)
//Clear placeholder when press input

$('#new_ic, #phone').mousedown(function() {
  $(this).attr('placeholder', '');
  // console.log( 'pressed');
});

 

lazacode.org - Malaysia's programming knowledge sharing platform, where everyone can share their finding as reference to others.
...