jQuery .mousedown on HTML input or attribute

0 votes
342 views
added Sep 20, 2018 in jQuery by LC Marshal Captain (25,790 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 (25,790 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.
...