HTML onclick event 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">
Browser Support
Status
Attribute Values
Value | Description |
---|---|
script | Specifies the script to be run on onclick |
Technical Details
Supported HTML elements:
All HTML elements, EXCEPT: <base>, <bdo>, <br>, <head>, <html>, <iframe>, <meta>, <param>, <script>, <style>, and <title>