i have this code:
$('.myButton').live('click',function(){
var checkTextValue = setTimeout(function() {
var textVal = $('p').text();
if (textVal == 'expectedValue'){
alert('done');
} else {
setTimeout(arguments.callee, 10);
}
},10);
});
when the button is clicked for the first time it works just fine, but when the button is clicked more than once alert is called n+ times(if i click one more time on the button an alert pops->i click "ok" and then one more alert pops; after this if i click one more time 3 alerts pops); is there any way to remove the function after textVal == 'expectedValue' returns true ?