HTML onclick Attribute
Example
<button onclick="myFunction()">Click me</button>
Meaning
The onclick attribute specifies the script run a mouse click on the element.
Standard Syntax
<element onclick="script">
Applies to:
The onclick attribute can be used on the following element:
| Element | Attribute |
|---|---|
| All HTML elements | onclick |
Advertisement
Attribute Values
| Value | Description |
|---|---|
| script | Specifies the script to be run on onclick |