Example
Execute a piece of JavaScript when the button is clicked:
Browser support
IE
Firefox
Chrome
Safari
Opera
All major browsers support the onclick attribute.
Definition and Usage
The onclick attribute is triggered by a mouse click on the element.
Note: The onclick attribute does not apply to the following elements:
, , ,
The above is the detailed content of The event attribute onclick triggered by a mouse click on an element in html. For more information, please follow other related articles on the PHP Chinese website!