Advertisement
Home Open Editor ❯

HTML onclick event Attribute

Example

<button onclick="myFunction()">Click me</button>

Try this code ❯

Meaning

The onclick attribute specifies the script run a mouse click on the element.


Standard Syntax

<element onclick="script">


Advertisement

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>
Home Open Editor ❯
Advertisement