Get element near string - Javascript jQuery

Javascript examples for jQuery:String

Description

Get element near string

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.9.1.js"></script> 
  <script type="text/javascript">
    $(window).load(function(){//w  w w .j a  va2 s  . co  m
console.log($("body:contains(Ratings\:)").find("strong").html());
    });

      </script> 
 </head> 
 <body> 
  <p>This is some text</p> Ratings: 
  <strong> <a href="http://www.foo.co">Kids +13</a> </strong>  
 </body>
</html>

Related Tutorials