Try It Editor
Tip: Press
Ctrl/⌘ + Enter
to Run
▶ Run
Reset
Copy
Download
Code
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Hello jQuery</title> <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> </head> <body> <button id="btn">Click me</button> <div id="msg" style="margin-top:10px; font-weight:bold; color:blue;"></div> <script> $(document).ready(function(){ $("#btn").click(function(){ $("#msg").text("Hello, jQuery!"); }); }); </script> </body> </html>
Output