Click here to Skip to main content
15,901,001 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
how to change all input type button value in page using jquery
Posted
Comments
Sergey Alexandrovich Kryukov 7-Feb-13 0:39am    
What have you done so far? The problem is pretty easy.
What do you mean by "value"? The text written on a button, or what?
—SA

The first thing you need is the button selector: jQuery( ":button" )
An equivalent selector to $(":button") using valid CSS is $("button, input[type='button']")
Reference: :button Selector[^]

Now that you have selected all button, you can set the value using
.val()
[^] selector.

Combining both the steps above,
JavaScript
$(":button").val("SomeValue");
 
Share this answer
 
Comments
Ankur\m/ 7-Feb-13 2:16am    
If it's not working, why have you accepted the answer?
Use val to set the value like I have shown in my answer.
First Button



Second Button



Third Button




C#
$("input:button").each(function () {

             //                alert('j');
             if ($(this).val() != 'Modify') {
                 alert($(this).val());
                 $(this).attr('value', 'Show');
             }
         });
 
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