JQuery div tag has children in FireFox but not Chrome
- by John Edwards
I am using JQuery ajax to load images from a url, display them, and then place a button on top of each image.
The code works in firefox, but in chrome, the div parent "photos" that should have all the children(one child div "photo" for each image received from the url) is 0.
I have tried read() and load(), but nothing seems to work. If I run alert($('#photos').children().size()); in the Chrome console it returns the children. But at execution 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