JSFiddle - React, Tailwind, and code Playground

by ergec

HTML

Type something and press Enter or simply outside the textbox<br>
<input type="text" id="mytextbox" />
<br><br><br>
Just click Submit button do not type anything in the textbox<br>
<input type="text" id="mytextbox2" />
<input type="button" id="mybutton" value="Submit" />

JavaScript

$("#mytextbox").change(function() {
    alert("Change triggered.");
});
$("#mytextbox2").change(function() {
    alert("Change triggered.");
});
$("#mybutton").click(function() {
    $("#mytextbox2").val("This does not trigger change.");
});