I dinamically add an input box in a table cell. The HTML I add is:
cell.html('<input type="text" id="finder" data-type="cittaNascita" value="'+value+'">');
The input is dinamically added so I then added:
$(document).on('change','#finder',function(){
console.log('cerco altra citta');
});
but I never see the message in console. This code works fine anyway:
$(document).on('keyup','#finder',function(){
console.log('cerco altra citta');
});
so I expect it to be something related to .on('change', but even looking on SO my code should be working fine. What do I miss here?
You can use .on('input' event instead to fire the change event without actually leaving the input, it fires right after the value has changed.