Easy Tutorial
❮ Att Input Formtarget Av Prop Seeking ❯

HTML onclick Event Attribute

HTML Event Attributes

Example

Run a script when the mouse button is clicked:


Browser Support

All major browsers support the onclick event attribute.


Definition and Usage

The onclick attribute is triggered when the mouse button is clicked.

Note: The onclick attribute cannot be used with the following elements: <base>, <bdo>, <br>, <head>, <html>, <iframe>, <meta>, <param>, <script>, <style>, or <title>.


Differences Between HTML 4.01 and HTML5

None.


Syntax

Attribute Values

Value Description
script Specifies the script to run when the onclick event is triggered.

❮ Att Input Formtarget Av Prop Seeking ❯