Q:

jquery check if input value has changed dynamically

I have to implement following issue.  I have input and i need to show warning message if its value has changed.  But for some reasons alert shows few times, can't figure out why.  Here was the first question. 
$("#input").bind("propertychange change paste input", function(){
    alert("Value has been changed");
});

The second question:
How can i check if input's value has changed dynamically.  For example if i click on some element then value changes. 
$("a").click(function(){
    $("#input").val("test");
})

Here's a fiddle i've created. 
Any ideas?  Thanks in advance! 

A:

There is no event raised when an inputs value is changed dynamically.  Your best option is to manually raise an event upon changing the value:
$("a").click(function(){
    $("#input").val("test").trigger('change');
})

