Click here to Skip to main content
15,905,028 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i wrote following code

XML
<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 () {
            $("button").click(function () {
                $("#test").hide();
            });
        });
<body>
<p class="test">This is another paragraph.</p>
 <asp:Button ID="button"  runat="server" Text="click" />
</body>


on runtime i am not getting output when i click button "This is another paragraph" should hide.
pls tell
Posted
Updated 23-Jan-13 3:28am
v2

$(document).ready(function () {
            $("#button").click(function () {
                $(".test").hide();
            });
        });


try the above statement and it should work. Also make sure you have correct closing and starting tags as suggested by user : s_mon

In jquery if you are accessing control by ID then you should provide #YourControlID and
if you want to access by Class then you should write .YourControlClass.
 
Share this answer
 
Comments
fjdiewornncalwe 23-Jan-13 9:30am    
+5. Good catch.
Member 9581488 23-Jan-13 9:32am    
Thank you :)
p class="test">This is another paragraph.</p>... shouldn't this be <p class="test">This is another paragraph.</p>

and your tags are slightly muddled up... there's a closing </script> missing
 
Share this answer
 
v4

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