62
rated 0 times
[
63]
[
1]
/ answers: 1 / hits: 16838
/ 12 Years ago, mon, july 30, 2012, 12:00:00
Possible Duplicate:
Listening for variable changes in JavaScript or jQuery
How can I track if this variable has changed?
var ConditionalFlag = 0;
I tried this:
var ConditionalFlag = 0;
$(ConditionalFlag).change(function () {
alert(Changed);
});
ConditionalFlag++;
But to no avail. I have considered using a 25ms timer to check for change like this:
var ConditionalFlag = 0;
function CheckFlag() {
if (ConditionalFlag > 0) {
alert(Changed);
clearInterval(check);
}
}
var check = window.setInterval(CheckFlag(), 25);
ConditionalFlag++;
However, that seems like overkill. Is there a way to attach an event handler to this variable with jQuery or javascript?
More From » jquery