I use change(handler) to listen to change events to a textarea, but I only receive an event when the textarea loses focus, but I want to receive an event as soon as the value changes.
$("#text_object").change(listener); function listener(dom){ alert("I'm not getting here before the textarea loses focus"); }
according to the right answer here Javascript change event on input element fires on only losing focus
you should do something like this
$('#name').on('change textInput input', function () { });
however I found that having both textInput and input events can cause the event to fire twice, you don't want that, so just do
$('#name').on('change input', function () { ...
Unfortunately the browser only recognises a change when the field blurs, so you might want to try attaching a keyup listener. Not the most elegant solution, unfortunately.
Details at http://api.jquery.com/keyup/.
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