Toggle button text on click jquery
I'm looking for toggle button text on click using jquery, but it doesn't work as expected.
<asp:Button ID="btnedit" runat="server" Text="Edit" Visible="True"
CssClass="actButton" CausesValidation="False" OnClick="btnedit_Click" />
On the client side:
$("#<%= btnedit.ClientID %>").click(function (e) {
$(this).text(function (i, text) {
return text === "Edit" ? "Cancel" : "Edit";
});
});
Can someone please advise me how to solve this?
+3
source to share
2 answers