I have the following html snippet:
<div id="contentX"><h1>MyHeading1</h1></div>
I could select with jQuery snippet syccessfully with the following:
console.log($('#contentX h1'));
The output is
[<h1>MyHeading1</h1>]
However, it did not work when I dynamically loaded the contents. For example,
html code snippet:
<div id="content"></div>
jQuery code snippet:
$('#content').load('foo.html')); // the content is loaded correctly with <h1> tag
jQuery code snippet does not work:
console.log($('#content h1')); // it returns []. I was expecting to return something.
I am wondering if this is a similar behavior like event binding: .click() vs .live().
Thanks in advance for your help.
foo.htmlcontain?