Suave Nti
Suave Nti

Reputation: 3739

Changing Text of asp:Button using Jquery

Am trying to change text of an asp:Button using jQuery Like this

  $("#<%=delButton.ClientID%>").attr('text', 'InActivate');
  .....
  <asp:Button ID="delButton" runat="server" UseSubmitBehavior="false" Text="Activate "    
   CssClass="button"   ToolTip="" OnClientClick="ondel();return false;"/>

I can see the text changing, Is the proper way to do?

Thanks

Upvotes: 4

Views: 11658

Answers (2)

Andomar
Andomar

Reputation: 238068

Yes, that's the best way I know of. This will get you the right client id regardless of clientIDMode:

<%= delButton.ClientID %>

Upvotes: 1

Alex Dn
Alex Dn

Reputation: 5553

This is shorter ;)

$("#<%=delButton.ClientID%>").val('InActivate');

Upvotes: 9

Related Questions