jQuery - on change input text
This is from a comment on the jQuery documentation page:
In older, pre-HTML5 browsers, "keyup" is definitely what you're looking for.
In HTML5 there is a new event, "input", which behaves exactly like you seem to think "change" should have behaved - in that it fires as soon as a key is pressed to enter information into a form.
$('element').bind('input',function);
Seems to me like you are updating the value of the text field in javascript. onchange
event will be triggered only when you key-in data and tab out of the text field.
One workaround is to trigger the textbox change event when modifying the textbox value from the script. See below,
$("#kat").change(function(){ alert("Hello");});$('<tab_cell>').click (function () { $('#kat') .val($(this).text()) //updating the value of the textbox .change(); //trigger change event.});
This technique is working for me:
$('#myInputFieldId').bind('input',function(){ alert("Hello"); });
Note that according to this JQuery doc, "on" is recommended rather than bind in newer versions.