Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML onclick Event Attribute

HTML onclick Event Attribute

HTML Event Attributes HTML Event Attributes

Example

Run a script when the mouse is clicked:

Try it »


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the onclick event attribute


Definition and Usage

The onclick attribute is triggered when the mouse is clicked.

Note: The onclick attribute cannot be applied to the following elements:, ,
, , ,