Run ❯
Get your
own
website
Result Size:
625 x 565
×
Change Orientation
Save Code
Change Theme, Dark/Light
Go to Spaces
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script> </head> <body> <h2>Get Text Content</h2> <p id="01">Hello World!</p> <p id="02">Hello Sweden!</p> <p id="03">Hello Japan!</p> <p id="demo"></p> <script> $(document).ready(function() { var myText = $("#02").text(); $("#demo").text(myText); }); </script> </body> </html>