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

Était-ce utile?

La solution

This is shorter ;)

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

Autres conseils

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

<%= delButton.ClientID %>
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top