I have 2 input that i send some value from input1 to input2 i want detect when input2 is changed.
HTML
<input type="text" id="input1"/>
<input type="text" readonly id="input2"/>
JS
$('#input1').on("change" , function() {
if($("#input1").val() == "550") {
$("#input2").val("2012")
}
else if($("#input1").val() == "650") {
$("#input2").val("2013")
}
else {
$("#input2").val("")
}
})
now i want detect when input2 have value and when is empty
this code don't work because it when happened that input have changed with keyboard or etc
$('#input2').on('input',function(e){
alert('Changed!')
});
I need a code like that to detect every changes in input2 , thanks