jQuery text()
get text content
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"> </script>/*from www . j a v a2 s . c om*/ <script> $(document).ready(function(){ $("button").click(function(){ document.getElementById("demo").innerHTML = $("p").text(); }); }); </script> </head> <body> <p id="demo"></p> <button>Return the text content of all p elements</button> <p>This is a paragraph.</p> <p>This is <b>another</b> paragraph.</p> </body> </html>