show all p elements' text - Javascript jQuery

Javascript examples for jQuery:Text

Description

show all p elements' text

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.3.js"></script> 
  <script type="text/javascript">
    $(window).load(function(){//w ww .  jav a2  s .c  o m
$("document").ready(function(){
    var data = '';
    $("p").each(function(){
        data += $(this).html();
    });
    console.log(data);
});
    });

      </script> 
 </head> 
 <body> 
  <p> Deneme </p> 
  <p> Deneme2 </p>  
 </body>
</html>

Related Tutorials