Click here to Skip to main content
15,886,689 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How do I find the way to change the text of a button in jQuery?
XML
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
    <script type="text/javascript">
        $(function () {
            $("#<%= Button1.ClientID %>").???() = "ChangeTextofButton";
        });
    </script>

ASP.NET
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
Posted
Updated 3-May-15 8:32am
v2

Hi,

Please try this it will work for me.

$("#Button1").prop('value', 'Submit');

Thanks
 
Share this answer
 
 
Share this answer
 
v2
Comments
teledexterus 3-May-15 14:58pm    
I have tried ".text()" and ".val()" those did not work.
Sergey Alexandrovich Kryukov 3-May-15 15:39pm    
You should not have "tried". You should have read documentation, understand and wrote appropriate code.
—SA
Hi,

Sergey Alexandrovich Kryukovc is correct. you should read the documentations and then apply the syntax as you cant depend on the solutions from Google.
Anyway this is how you can replace the button text using jQuery.

$("#<%= Button1.ClientID %>").prop("value","Clicked");
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900