I create new jQuery element:
var myJqEl = $('<div id="myDiv">Div content<span>Span content</span></div><p>P content</p>');
then I use find method on it:
var mynewEl1 = myJqEl.find('div').html(); // return null
var mynewEl2 = myJqEl.find('span').html(); // return Span content
var mynewEl3 = myJqEl.find('p').html(); // return null
Could you tell me why the first and the third return null while the second return the full content?
Thank you.
Use
filterfor thedivandpinstead: