I'm looking to toggle the text of a button on the click using jquery, But it is not working properly.

```
<asp:Button ID="btnedit" runat="server" Text="Edit" Visible="True"
                    CssClass="actButton" CausesValidation="False" OnClick="btnedit_Click" />

```

On 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?