JQuery div tag has children in FireFox but not in Chrome

I use jQuery ajax to load images from a URL, display them, and then put a button on top of each image.

The code works in firefox, but in chrome, the parent "photos" div that should have all children (one child div "photo" for each image received from the URL) is 0.

I tried read() and load() but nothing works. If I run alert($('#photos').children().size()); in the Chrome console, it will return the children. But when executed, it returns 0. Any ideas?

 $(window).load(function () { $("p").text("The DOM is now loaded and can be manipulated."); //returns 0 in chrome, but 10 in firefox alert($('#photos').children().size()); $('#photos').children().each(function() { //do stuff 
+4
source share
1 answer

I solved the problem. For some reason, the local chrome server was not working, so javascript did not start at the right time. Thanks.

0
source

All Articles