Reputation: 111
I am having problem here, I can get the 'Text
' of asp.net button by using 'val()
' in jQuery, but could not set the 'Text' in any way. I have tried 'attr
','prop
','val()
','text()
' and 'html()
'. Please help.
JavaScript
$("#<%= hiddenButton.ClientID %>").attr('text', 'hello');
var sh = $("#<%= hiddenButton.ClientID %>").val();
alert(sh);
ASPX
<asp:Button ID="hiddenButton" runat="server" onclick="hiddenButton_Click" Text="NORTH EAST FESTIVAL" />
The alert box still shows "NORTH EAST FESTIVAL".
my html is inside a content placeholder, which is inside a form tag.
Upvotes: 1
Views: 1205
Reputation: 82231
you need to use .val()
to set the value instead of setting the attribute:
$("#<%= hiddenButton.ClientID %>").val('hello');
Upvotes: 1