Reputation: 5209
I have asp.net server side button. I want to change the value of type attribute from submit to button.
Button :
Currently I used the below code to change the value of type attribute
var submitForm = "<%=submitForm.ClientID %>";
$('#' + submitForm).attr("type", "button");
but I found below error : uncaught exception: type property can't be changed
How can I change the value?
Upvotes: 1
Views: 917
Reputation: 12341
The answer works, but seems there is another (perhaps more fundamental) question - why even go that route? If you needed a "regular" button, then use a standard html button or a server side HTML button:
If you just want to have a button to script client side:
<input type="button".... />
instead of <asp:button....
If you want the 'best of both worlds' use a "server HTML control":
<input type="button" runat="server"...../>
Unsure what you were after, but sometimes it pays to take a step back and take another look....
Upvotes: 1
Reputation: 1931
please try below code
$('#' + submitForm).prop("type", "button");
Upvotes: 3