Strange Behaviour With jQuery.find() - Javascript jQuery

Javascript examples for jQuery:Tag Traversing

Description

Strange Behaviour With jQuery.find()

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <script type="text/javascript" src="https://code.jquery.com/jquery-1.8.3.js"></script> 
  <script type="text/javascript">
    $(window).load(function(){/*from   w w  w.  java  2  s .co  m*/
var data = $("<html><title>hello</title><body><form><ul><li>here</li></ul></form></body><ul><li></li></ul></html>");
console.log(data.filter("form").length);
console.log(data.find("ul").each.length);
    });

      </script> 
 </head> 
 <body>  
 </body>
</html>

Related Tutorials