How to use Hide Test Class and Id Method in JQuery

This article describe about jQuary hide class and id method.
  • 2069

Hide text class in jQuery

Hide test method is defined two methods.

$("#test").hide() method with id

hide() method is use to hide a test.

$("#test").hide() is use hiding where <id = test> element above this page.

Example

<!DOCTYPE html>

<html>

<head>

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

<script type="text/javascript">

    $(document).ready(function ()

{

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

{

            $("#test").hide();

        }

);

    }

);

</script>

</head>

 

<body>

<h2>This is a jQuery</h2>

<p>This is a test.</p>

<p id="test">This is another test.</p>

<button>Click me</button>

</body>

</html>

 

Output

 op1.jpg

 

After click button

 op2.jpg

$("#test").hide() method with class

hide() method is use to hide a test.

$("#test").hide() is use hiding where <class = test> element above this page.

Example

<!DOCTYPE html>

<html>

<head>

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

<script type="text/javascript">

    $(document).ready(function ()

{

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

{

            $(".test").hide();

        }

);

    }

);

</script>

</head>

<body>

 

<h2 class="test">This is a jQuery</h2>

<p class="test">This is a test.</p>

<p>This is another test.</p>

<button>Click here</button>

</body>

</html>

 

Output

 

 op1.jpg

After click button

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

Programming Answers here

© 2020 DotNetHeaven. All rights reserved.