Advertisement
Home Open Editor ❯

HTML ontoggle Attribute

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>

Try this code ❯

Meaning

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


Standard Syntax

<element ontoggle="script">


Applies to:

The ontoggle attribute can be used on the following element:

Element Attribute
<details> ontoggle

Advertisement

Attribute Values

Value Description
script Specifies the script to be run on ontoggle
Home Open Editor ❯
Advertisement