I have an <input type = "text">
binded with a "keypress" event, as follows (see jsfiddle here: http://jsfiddle.net/periklis/RMyc7/):
<form name = "myform" method = "post">
<input type = "text" name = "mytext" id = "text_id"/>
<input type = "submit"/>
</form>
<script>
$(document).ready(function() {
$('#text_id').bind('keyup', function() {
console.log('pressed!');
});
});
</script>
My problem is that if I select one of the browser recommendations for the field (previously entered values), then the keyup event won't fire. What do you suggest I should do to work around this?
Tested on chromium 17 and Firefox 10
Thanks as always
Try binding to both
keyup
andchange
.I ended up setting 'autocomplete=off' to my field to prevent this from happening