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");
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…