Source Code:
(back to article)
Submit
Result:
Report an issue
<!DOCTYPE html> <html> <head> <title>jQuery Element Selection</title> <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> </head> <body> <div class="content">Hello World</div> <button id="change-text">Change Text</button> <script> $(document).ready(function(){ $("#change-text").click(function(){ $(".content").text("Hello jQuery"); }); }); </script> </body> </html>