Javascript examples for jQuery Method and Property:text
Return the text content of all p elements
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("button").click(function(){ console.log($("p").text()); });//from www.j av a2 s. c o m }); </script> </head> <body> <button>test</button> <p>This is a <span>paragraph</span>.</p> <p>This is <b>another</b> paragraph.</p> </body> </html>