How To Use Hide Method With Speed Parameter In JQuery

admin_img Posted By Bajarangi soft , Posted On 12-10-2020

In Jquery we can hide or disappear html element by giving speed parameter to hide method .so today we discuss how to do it

How To Use Hide Method With Speed Parameter In JQuery

Step 1:Create index.html file and implement below code.

<button class="btn btn-success" id="hide">Hide</button>
<button class="btn btn-success" id="show">Show</button>
<br>
<p>If you click on the "Hide" button, I will disappear.</p>


Step 2:Implement jquery to hide html element Slowly.

<script>
    $(document).ready(function(){
        $("#hide").click(function(){
            $("p").hide(1000);
        });
        $("#show").click(function(){
            $("p").show(1000);
        });
    });
</script>


Complete Code For Hiding And Showing HTML Elements Using JQuery

<!DOCTYPE html>
<html>
<head>
    <title>How To Use Hide Method With Speed Parameter In JQuery</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
</head>
<style>
    body {
        background: darkolivegreen;
    }
</style>
<body>
<div class="container">
    <br><br><br>
    <div class="text-center">
        <h2 id="color" style="color: White">Hide Method With Speed Parameter In JQuery</h2>
    </div>
    <br>
    <br>
    <div class="well">

        <button class="btn btn-success" id="hide">Hide</button>
        <button class="btn btn-success" id="show">Show</button>
        <br>
        <p>If you click on the "Hide" button, I will disappear.</p>
    </div>
</div>
</body>
</html>
<script>
    $(document).ready(function(){
        $("#hide").click(function(){
            $("p").hide(1000);
        });
        $("#show").click(function(){
            $("p").show(1000);
        });
    });
</script>

Related Post