i’ve a problem… What am I doing wrong?
I want to use a selector previously saved in a variable. The idea is to use it within a function in an object.
var escribir = {
obj:$('#cont'),
algo: function(i) {
escribir.obj.html(i++);
setTimeout('escribir.algo('+i+')',1000);
}
}
$(document).ready(
function(){
escribir.algo(0);
}
);
....
<div id="cont"></div>
You’d probably be better if you made use of closures in better form.
This way, you’re not using
setTimeout‘sevalversion.