").attr(...">

Change asp button text: using jQuery

I am trying to change the 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 see how the text is changing. Is this right to do?

thanks

+4
source share
2 answers

This is shorter;)

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

Yes, this is the best way I know about. This will give you the correct client identifier, regardless of clientIDMode :

 <%= delButton.ClientID %> 
+1
source

Source: https://habr.com/ru/post/1391387/


All Articles