$("#pass").val("").trigger("change");
$("#pass_con").val("").trigger("change");
What s the use of using trigger statement here
$("#pass").val("").trigger("change");
$("#pass_con").val("").trigger("change");
What s the use of using trigger statement here
On change event occurs when user enters values manually, i.e. events initiated by user and not the JS code. Setting the value using .val()
do not trigger change event.
Thus,.trigger("change");
or .change();
needs to be used for triggering change event attached to it.
May be there are change listeners registered on #pass
, #pass_con
elements.
Changing the value of these nodes programatically will not trigger a change event.
Manually triggering the change event for the listeners to be notified.