I’m trying to put some placeholders in a form. They are working fine in Chrome and Firefox, but I can’t get them to work on IE (I’m testing this with IE9). The problem is that the input event only fires when adding text to the input and not when deleting (with delete key, cut, right click, etc).
This is my code (uses jQuery):
$input.on('input propertychange', function() {
if($input.val() == '')
$placeholder.show();
else $placeholder.hide();
});
I read that this may be a known issue. If so, are there any workarounds?
Thank you for your help.
If you want to check on special keys you should go with keyup:
http://api.jquery.com/keyup/
If you just want to fire an event on any change you should go with the change event:
http://api.jquery.com/change/