In the following code i want to know how to detect when text is inserted dynamically in input field
<input id="test"><br />
<a href="#">Click me</a>
$("#test").on("input", function() {
alert("Change to " + this.value);
});
$("a").on("click", function() {
$("#test").val("In clicks we trust.");
});