button click using jquery

Posted by DotnetSparrow on Stack Overflow See other posts from Stack Overflow or by DotnetSparrow
Published on 2011-02-28T05:44:47Z Indexed on 2011/02/28 7:25 UTC
Read the original article Hit count: 173

Filed under:

Hi All:

I have an asp.net button on a page without masterpage like this:

<asp:Button ID="target" runat="server" Text="Animate Me" >
</asp:Button>

and I am calling this:

var panel = $('#<%= target.ClientID %>');
panel.click(function(){
  alert($(this).attr("value")); 
});

but no alert is shown. I even tried this:

$('#target').click(function(){
  alert($(this).attr("value")); 
});

but It didnt work.

Please suggest me how to click the button and what is issue in above code.

Thanks.

© Stack Overflow or respective owner

Related posts about jQuery