HTML ontoggle event Attribute

❮ HTML Event Attributes

Example

<details ontoggle="myFunction()">
  <summary>HTML</summary>
  <p>The first version of HTML was written by Tim Berners-Lee in 1993. Since then, there have been many different versions of HTML. The most widely used version throughout the 2000`s was HTML 4.01, which became an official standard in December 1999.</p>
</details>

Meaning

The ontoggle attribute specifies the script to be run when the user opens or closes the <details> element.


Standard Syntax

<element ontoggle="script">

Browser Support




Status







Attribute Values

Value Description
script Specifies the script to be run on ontoggle



Technical Details

Supported HTML elements:

<details>
❮ HTML Event Attributes