How to use Effect Hide() and Show() Method in JQuery

In this article I am going to explain about Effect Hide() and Show() method in jquery.
  • 2248

jQuery Hide() and Show() Method

jquery Hide() method use for hide the selected element and Show() method use for show the selected element.

Syntax

$(selector).hide()

 

$(selector).show()

 

Example

 

<html>

<head>

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

    <script type="text/javascript">

        $(document).ready(function () {

            $("#but1").click(function () {

                $("p").hide();

            });

            $("#but2").click(function () {

                $("p").show();

            });

        });

    </script>

</head>

<body>

    <p>

        click hide for hide and click show for show</p>

    <button id="but1">

        Hide</button>

    <button id="but2">

        Show</button>

</body>

</html>

 

Output


hide.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.