Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
Execute a script when the user opens or closes the <details> element in HTML?
When a user opens or closes the <details> element, the ontoggle event fires. You can try to run the following code to implement ontoggle event attribute −
Example
<!DOCTYPE html>
<html>
<body>
<h2>Details</h2>
<p>You need to join office from Feb23<p>
<details ontoggle="display()">
<summary>More Information</summary>
<p>Timings: 9 to 5:30</p>
<p>Office location: Hyderabad</p>
</details>
<script>
function myFunction() {
alert("Timings, office location, etc");
}
</script>
</body>
</html> Advertisements
