Click here to Skip to main content
12,071,437 members (34,922 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C# 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 2:49am
Edited 23-Jan-13 4: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 23-Jan-13 9:30am
   
+5. Good catch.
Member 9581488 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)

  Print Answers RSS
Top Experts
Last 24hrsThis month


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

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100