HTML - attributes - ontoggle

revision:


Content

"ontoggle" attribute : when an element is opened or closed syntax some examples


"ontoggle" attribute : when an element is opened or closed

top

The ontoggle attribute fires when the user opens or closes a <div> element. The <div> element specifies additional div that the user can view or hide on demand.

The ontoggle attribute is part of the event attributes and can be used on the following element: <div>.


syntax

top

<element ontoggle="script></element>

script: this attribute contains single value script which works when the ontoggle event is called.


some examples

top

Open the div.

Copyright 1999-2014.

- by ... . All Rights Reserved.

All content and graphics on this web site are the property of . . . . .

codes:
                    <p class="spec">Open the div.</p>
                    <div style="margin-left:3vw;" ontoggle="myDetails()">
                        <p>Copyright 1999-2014.</p>
                        <p class="spec"> - by ... . All Rights Reserved.</p>
                        <p class="spec">All content and graphics on this web site are 
                        the property of  . . . . .</p>
                    </div>
                    <script>
                        function myDetails() {
                        alert("The ontoggle event occured");
                        }
                    </script>
                

Click below to open the div.

What is the full form of HTML

Hyper Text Markup Language

codes:
                    <p class="spec">Click below to open the div.</p>
                    <div style="margin-left:3vw;" ontoggle="more()">
                    <p style="color:blue";>What is the fullform of 
                    HTML</p>
                    <p class="spec">Hyper Text Markup Language</p>
                    </div>
                    <script>
                        function more() {
                            alert("The ontoggle event triggered");
                        }
                    </script>