I’ve been working on a problem with a project for a while. Basically, I use .html() to load entries into a div. It all looks fine, but I tried to get the value of the :first-child, and it wouldn’t work unless I put the entries directly into the HTML (as in, the source file) — but I can’t do that because the entries need to load dynamically (via JS).
So, I went to look at the page source to see what’s up, and nothing showed up in the div where my entries were being loaded. I checked Firebug, and it showed that they were inside that div. The webpage itself showed that they were inside that div. But the page source did not.
Why wouldn’t the HTML loaded by jQuery appear in the page source?
Updated
Alright, you guys answered why – so, I guess my real question is “how” to do what I’m trying to do –
The div loads several entries into #inner-wrap that look somewhat like:
<div class="entries">
<input type="submit" value="1295843239" style="display: none;" class="realtime">
<span class="time">1295843239:</span>
<span class="name">Name: </span>
<span class="message">this is an entry...</span>
</div>
How would I select the value of the input of the first child of #inner-wrap?
I was using $("#inner-wrap :first-child .realtime").val(), but that didn’t work when the entries were loaded dynamically. Here’s all the related code, and here’s the “live” bits of what I have so far. It’s nowhere near done, but I need to be able to get the time of the last comment to check for new comments.
Dynamic html will not show in the source when using jQuery unless a postback has occurred. You would need to use a tool such as Firebug to verify the contents or force a postback by adding a form and posting to the same page.