Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

ontoggle event

ontoggle event

Event Object Reference Event Object

Example

When

Execute JavaScript when the element is opened or closed:

Try it »


Definition and Usage

The ontoggle event 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.

Events
ontoggle 12.0  Not supported Not supported 6.0 15.0

Syntax

In HTML:

<

element

ontoggle="

myScript

">

Try it

In JavaScript:

object

.ontoggle=function(){

myScript

};

Try it

In JavaScript, use the addEventListener() method:

object

.addEventListener("toggle",

myScript

);

Try it

Note: Internet Explorer 8 and earlier IE versions do not support addEventListener() method.


Technical Details

Does it support bubbling: No
Is it cancelable: No
Event type: Event
Supported HTML tags:

Event Object Reference Event Object