jQuery Get Content
<!DOCTYPE html> <html> <head> <script src="https://code.jquery.com/jquery-3.7.1.min.js"></script> </head> <body> <p id="demo">Hello <b>world</b>!</p> <button id="getText">Get Text</button> <button id="getHtml">Get HTML</button> <script> $(document).ready(function() { $("#getText").click(function() { // Returns: Hello world! alert($("#demo").text()); }); $("#getHtml").click(function() { // Returns: Hello <b>world</b>! alert($("#demo").html()); }); }); </script> </body> </html>