The following method is used to attached the click event to the button:
Hello world alert box example(HelloAlert.html)
Description of the program
For using jQuery script ,we write it inside <script> tag. The below code checks whether the page loading is finished (DOM elements are ready or fully loaded) and if page loading is finished then it executes the code in the block.
// Your code here
The Html page contains a button named "cl", when click event is triggered on this element , it will display a alert box showing message "Hello World". The "alert()" function of jQuery creates a alert box having provided message.
Learn from experts! Attend jQuery Training classes.
Liked it! Share this Tutorial