I want to bind change event to textarea(read only) whenever its value is set dynamically by opening popup window.
I am able to set the value, but the change event is not getting fired.
I used below code to bind change event to textarea :
$('textarea[name="Cordinator"]').bind("change", onChangeCordinator);
function onChangeCordinator(){}
How are you setting the value? By default the change event fires only if the value is changed by the browser user.
If you are setting the value programatically you need to use .trigger('change')
So somewhere in your onclick handler you need:
$('textarea[name="Cordinator"]').trigger('change');
there is a syntax error in your js
change this to
$('textarea[name="Cordinator"]').bind("change", onChangeCordinator);});
this
$('textarea[name="Cordinator"]').bind("change", onChangeCordinator);
UPDATE:
well you need to trigger it manually after setting the value on textarea like this
$('textarea[name="Cordinator"]').val('Set Your Value Here').trigger('change');
DEMO
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