4

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

Suave Nti
  • 3,721
  • 11
  • 54
  • 78

2 Answers2

9

This is shorter ;)

$("#<%=delButton.ClientID%>").val('InActivate');
Alex Dn
  • 5,465
  • 7
  • 41
  • 79
  • The only note I would make to this is that if the object created is – spinon Jan 17 '12 at 07:34
1

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

<%= delButton.ClientID %>
Andomar
  • 232,371
  • 49
  • 380
  • 404