onchange
only fires when the user types into the input and then the input loses focus.
You can manually call the onchange
event using after setting the value:
$("#mytext").val( 777 ).change(); // someObject.onchange(); in standard JS
Alternatively, you can trigger the event using:
$("#mytext").val( 777 ).trigger("change");