$(\'input#not-gonna-work\').bind({
keyup: function(){
console.log(\'Typed a key\');
$(this).val($(this).val() + \'.\');// try with any other char
That seems to be the behavior to me.. If the value of an element is changed via script then your onchange will not be triggered. In such cases you need to save the value onfocus and check the value onblur and trigger onchange manually.
See below,
DEMO: http://jsfiddle.net/vCxme/6/
$('input#not-gonna-work').bind({
keyup: function(){
console.log('Typed a key');
$(this).val($(this).val() + '.');
},
change: function(){
console.log('I\'m a changed input');
},
focus: function ( ){
$(this).data('orig_value', $(this).val());
},
blur: function () {
if ($(this).val() != $(this).data('orig_value')){
$(this).change();
}
}
});
$('input#gonna-work').bind({
keyup: function(){
console.log('Typed a key');
},
change: function(){
console.log('I\'m a changed input');
}
});
The above implementation is from pseudo code as from FF onChange
Note: The browser change event will not be triggered when the value is changed via script.