Select by ID within jQuery object to get text - Javascript jQuery Selector

Javascript examples for jQuery Selector:id

Description

Select by ID within jQuery object to get text

Demo Code

ResultView the demo in separate window


<html>
   <head> 
      <script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> 
   </head> 
   <body> 
      <script>
var final = $("<span id='outer'> Outer Span </span><span id='inner'> Inner Span </span>");

var div = $("<div>").append(final);
console.log($("#inner", div).html());

      </script>  
   </body>//w  w  w .j a  v  a 2  s .co m
</html>

Related Tutorials