Javascript DOM ontoggle Event via HTML Tag ontoggle attribute

Introduction

In HTML:

View in separate window

<!DOCTYPE html>
<html>
<body>

<p>Open the details.</p>

<details ontoggle="myFunction()">
<summary>Copyright 2020-2024.</summary>
<p> - by java2s.com. All Rights Reserved.</p>
<p>All content and graphics on this web site are the property of the java2s.com.</p>
</details>/* w ww . j a  v a 2  s.  c o m*/
<p id="demo"></p>
<script>
function myFunction() {
  document.getElementById("demo").innerHTML = "The ontoggle event occured";
}
</script>

</body>
</html>
Bubbles: No
Cancelable: No
Event type: Event
Supported HTML tags: <details>



PreviousNext

Related