Select text between closed tags - Javascript jQuery

Javascript examples for jQuery:Selector

Description

Select text between closed tags

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.6.2.js"></script> 
  <script type="text/javascript">
    $(window).load(function(){/*from w w w . java 2 s.com*/
console.log($('p').contents().filter(function() {
    return this.nodeType == Node.TEXT_NODE;
}));
    });

      </script> 
 </head> 
 <body> 
  <p class="text"> <b>1</b> this is point one <b>2</b> this is point two <b>3</b> </p>  
 </body>
</html>

Related Tutorials