I have a textbox with a jquery change event tied to it.
$('#txtAccountNo').change(function(){
$('label[for="txtAccountNo"]').append('<span class="support">loading...</span>')
});
The event works when the textbox loses focus, ie the user clicks out of it with the mouse or uses the tab key. But when the return key is pressed the event is not fired. Can anybody help me resolve this please?
This is standard behaviour for the change
event. If you want to capture each Enter press you need to use the keypress
event:
$('#txtAccountNo').on('change keypress', function(e) {
if (e.type == 'change' || (e.type == 'keypress' && e.which == 13)) {
$('label[for="txtAccountNo"]').append('<span class="support">loading...</span>')
}
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With