What is onclick event in JavaScript?

The onClick event is the most frequently used event type, which occurs when a user clicks the left button of the mouse.

Example

You can put your validation, warning etc., against this event type.

   
      
   
   
      

Click the following button and see result

     
               
   
Updated on: 2026-03-11T23:14:17+05:30

683 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements