Question

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

Was it helpful?

Solution

This is shorter ;)

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

OTHER TIPS

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

<%= delButton.ClientID %>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top