JQuery div tag has children in FireFox but not Chrome
Posted
by
John Edwards
on Stack Overflow
See other posts from Stack Overflow
or by John Edwards
Published on 2012-12-14T11:00:21Z
Indexed on
2012/12/14
11:03 UTC
Read the original article
Hit count: 157
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
© Stack Overflow or respective owner