jQuery selector unable to find outer most DIV
Hello folks, I found an interesting issue while working with jQuery selctor.
Please share your ideas on this issue.
Here we go
Below is my jQuery syntax which looks pretty good.
But I don't understand why selector unable to produce expected result!!!
- var testHTML="<html><head></head><body><div id='outerDiv'><div id='innerFirstDiv'></div><div id='innerSecondDiv'></div></div></body></html>"
Well, here #outerDiv is the outer most div and #innerFirstDiv & #innerSecondDiv are two children div of #outerDiv div.
CODE WORKING FINE:
- $(testHTML).find('#innerFirstDiv') // or
- $(testHTML).find('#innerSecondDiv')
code not working STRANGE!!!!:
- $(testHTML).find('#outerDiv')?? its returning "[]"
this line of code should return me the outer most div but it's not!!!!!