Get your own website Result Size: 625 x 565
x
 
<!DOCTYPE html>
<html>
<body>
<p>This example uses the HTML DOM to assign an "ontoggle" event to a details element.</p>
<p>Open the details.</p>
<details id="myDetails">
<summary>Copyright 1999-2014.</summary>
<p> - by Refsnes Data. All Rights Reserved.</p>
<p>All content and graphics on this web site are the property of the company Refsnes Data.</p>
</details>
<script>
document.getElementById("myDetails").ontoggle = function() {myFunction()};
function myFunction() {
  alert("The ontoggle event occured");
}
</script>
</body>
<!-- Mirrored from www.w3schools.com/jsref/tryit.asp?filename=tryjsref_ontoggle_dom by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 21 Dec 2022 17:40:05 GMT -->
</html>