Edit in JSFiddle

//JavaScript variable watch for IE 8+ Brian Rosamilia

//Object prototypes source : https://gist.github.com/XoseLluis/4750176

$(function(){
    var test = { id : 1 };

    test.watch("id", function(prop, val, newval){ 
        //alert(newval); //Uncomment this to see both changes
        $('#name').val(newval);
    });
 
    test.id = 20;
    test.id = 234;   
});
<input id='name'/>

              

External resources loaded into this fiddle: