Click here to Skip to main content
15,881,651 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
XML
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>

    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/jquery-ui.min.js"></script>

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

</head>
<body>
    <form id="form1" runat="server">
    <div>
    <p>If you click on the "Hide" button, I will disappear.</p>
<button id="hide">Hide</button>
<button id="show">Show</button>
    </div>
    </form>
</body>
</html>



in output when i click on hide button .it hides data but instantly it shows me data back too.on hide button it should only hide data

when i double click then only it hides .on single click it doesn't......as i have used click function not dblclick....then why is it showing like this.
help!!

pls tell wat i missed
thanks
Posted
Updated 23-Jan-13 18:02pm
v2

Dear Shivani...it's not working because you have used
C#
<form runat="server"></form>


remove it..it will be working fine.. try this..

XML
<!DOCTYPE html>
<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js">
</script>
<script>
$(document).ready(function(){
  $("#hide").click(function(){
    $("p").hide();
  });
  $("#show").click(function(){
    $("p").show();
  });
});
</script>
</head>
<body>
<p>If you click on the "Hide" button, I will disappear.</p>
<button id="hide">Hide</button>
<button id="show">Show</button>
</body>
</html>
 
Share this answer
 
XML
Instead of Using following Button tags
<button id="hide">Hide</button>
<button id="show">Show</button>

use these html tags.

<input type='button' id="hide" value='Hide'/>

if u use <button> page gets reloaded and it display everything of ur content. just like asp:buttons. still if u want to use these buttons, please place "return false" in click functions of both buttons



XML
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>

    <script src="http://code.jquery.com/jquery-latest.js"></script>


<script  type="text/javascript">
    $(document).ready(function () {
        $("#hide").click(function () {


            $("p").hide('slow');


        });
        $("#show").click(function () {
           $("p").show('slow');

        });
    });
</script>

</head>
<body>
    <form id="form1" runat="server">
    <div>
    <p id="Ptag">If you click on the "Hide" button, I will disappear.</p>
<input type='button' id="hide" value='Hide'/>
<input type='button' id="show" value='show'/>
    </div>
    </form>
</body>
</html>
 
Share this answer
 
v3
Solution 2 is working...Thanks
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900