jQuery Basic Program

Last Updated:

jQuery Basic Program

In the following example, we will use jQuery to alert a welcome message when a button is clicked.

Note: You can use any JavaScript methods inside any jQuery callback functions.

Example

HTML Editor
<!DOCTYPE html> <html lang="en-US"> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> </head> <body> <h1>jQuery Basic program</h1> <button>Click Me</button> <script> $(document).ready(function(){ // all your jquery / javascript code goes here. $("button").click(function(){ alert("welcome to jQuery!"); }); }); </script> </body> </html>

Share this Page

Meet the Author