HTML ontoggle Event Attribute
Example
When
Execute JavaScript when the element is opened or closed:
<
details
ontoggle
=
"
myFunction()
"Try it »
Definition and Usage
The ontoggle attribute is triggered when the user opens or closes the
the element.
element, which describes additional information that the user can view or hide as needed.
Browser support
The numbers in the table indicate the version number of the first browser to support the event.
| Event attribute | |||||
|---|---|---|---|---|---|
| ontoggle | 12.0 | Not supported | Not supported | 6.0 | 15.0 |
Differences between HTML 4.01 and HTML5
The ontoggle attribute is new in HTML5.
Syntax
<
element
ontoggle="
script
">Technical Details
| Supported HTML tags: |
|
|---|
Related pages
HTML DOM Reference Manual: ontoggle event
HTML Event Attributes