Is there a way of adding a listener or binding an event to a value instead of a html element?
So an event is triggered when a value changes instead of when you click a button, etc...
Hypothetical code:
var changingValue = 1;
$('button').on('click',function(){
changingValue = changingValue + 1;
});
$(changingValue).on('change',function(){
alert("event triggered, the new value is:" + this)
});