JQuery Extract value from a tag in a String - Javascript jQuery

Javascript examples for jQuery:String

Description

JQuery Extract value from a tag in a String

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <title>SO - 18460764</title> 
  <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> 
 </head> //from   w  w  w .  j  a  va 2s  . c  o m
 <body> 
  <div> 
   <strong>1954</strong> im the text 
  </div> 
  <script type="text/javascript">
jQuery(function(){
    var pageNum = $("div").find('strong').text();
    console.log(pageNum)
})

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

Related Tutorials