Reputation: 6554
I have two variables:
var frame = $('#avacweb_chat iframe');
var time = $('.date-and-time' , frame.contents()).last().text();
var newTime = setInterval(function() {
var newT = $('.date-and-time' , frame.contents()).last().text();
},500);
As you can see one variable is in a setInterval and the other is not. So technically when I test these in a conditional it has to be inside the interval. Does anyone know how I can get these so that it will update the first variable if the second variable changes and then loop again? EX:
Var Time = [12:30:39 23/05/13]
Var newT = [12:31:39 23/05/13]
So now
Var Time = [12:31:39 23/05/13]
So then we would now need to test the var NewT again. Hope this explained it a little better. I am going to keep trying different things though if you have a suggestion please post it. Thanks guys
Upvotes: 0
Views: 49
Reputation: 74420
I could misunderstood your problem, but use:
var frame = $('#avacweb_chat iframe');
var time = $('.date-and-time' , frame.contents()).last().text();
var newTime = setInterval(function() {
var newT = $('.date-and-time' , frame.contents()).last().text();
if(newT != time)//seems like always true but im just speculating
time = newT;
},500);
Upvotes: 1