Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET .NET C#4.0
i wrote following code
 
<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 23-Jan-13 1:49am
Edited 23-Jan-13 3:28am
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

$(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.
  Permalink  
Comments
Marcus Kramer at 23-Jan-13 9:30am
   
+5. Good catch.
Member 9581488 at 23-Jan-13 9:32am
   
Thank you :)
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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
  Permalink  
v4

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



Advertise | Privacy | Mobile
Web04 | 2.8.140709.1 | Last Updated 25 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid