Reputation: 2126
I have a simple for loop inside jQuery but it is not working fine in Firefox.
Problem: It writes my variable fine but if you look at the Firefox tab it says
Connecting...
all the time.
Also if I check my script with Firebug it says:
No Javascript on this page
although it writes my variable.
What I am doing wrong here? Fiddle here
$(document).ready(function(){
var i=0;
for(i=0;i<=3;i++) {
document.write(i);
}
//alert("working");
});
Upvotes: 0
Views: 131
Reputation: 117354
Never use write() after the document has finished loading, it will overwrite the complete document(including scripts)
But however, when the issue is the fact that the (new)document didn't finish the loading-process in your example, call document.close()
after document.write()
Upvotes: 4