Javascript examples for jQuery:Text
Join text from a list of tag by name
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://code.jquery.com/jquery-1.11.0.js"></script> <script type="text/javascript"> $(function(){// w w w. j a va 2 s. co m console.log($('h3').map(function(){ return $(this).text(); }).get().join("\n")) }); </script> </head> <body> <h3>First</h3> <h3>Second</h3> <h3>Third</h3> </body> </html>