How to use Effect Toggle() Method in JQuery

In this article I am going to explain about Effect Toggle() Method in jquery.
  • 1982

jQuery Effect Toggle() Method

jquery toggle() method use for hide and show to selected element. Its toggle beetween Hide() and Show() method. Its chech If element is hide then run Show() and If element is visible then run Hide() method.

Syntax

$(selector).toggle()

 

Example

 

<html>

<head>

    <script type="text/javascript" src="jquery.js"></script>

    <script type="text/javascript">

        $(document).ready(function () {

            $("button").click(function () {

                $("h3").toggle();

            });

        });

    </script>

</head>

<body>

    <h3>

        Click Button for hide and show</h3>

    <button>

        click me</button>

</body>

</html>

Output

togg.jpg

You may also want to read these related articles: here
 
Ask Your Question 
 
Got a programming related question? You may want to post your question here
 
© 2020 DotNetHeaven. All rights reserved.