I have div id (auctions) and I want to change the HTML code with the children of the auction list. However, jQuery cannot select children of the auction div list.
Here's the HTML:
<div id="all"> <div id="auctions"></div> </div> <div id="auction-list" class="hide"> <div class="auction">Test</div> <div class="auction">Test</div> </div>
Here's jQuery:
alert($("#auction-list").children().length); alert($("#auction-list").html()); alert($("#auction-list:nth-child(1)").html()); alert($("#auction-list:nth-child(2)").html()); $("#auctions").html($("#auction-list:nth-child(1)").html());
And here are the outputs for Javascript warnings:
First warning
2
Second warning
<div class="auction">Test</div> <div class="auction">Test</div>
Third Alert
null
What am I not seeing here?
source share