Change Button Text Using jQuery




Here we consider how to change the button text using jQuery. Lets start with one example here. Suppose we have two buttons inside form as shown below.

Change Button Text Using jQuery, Change Button Text In jQuery, How To Change Button Text Using jQuery, How To Change Button Text In jQuery, Replace Button Text Using jQuery, Replace Button Text In jQuery, Button Text In jQuery, Replace Button Text, Button Text, jQuery, HTML, PHP




First of all consider input button. Here we can make use of jQuery prop or attr or jQuery Value attribute.





$(function () {
         $("#inputBtnID").val('New Value');
});







$(function () {
         $("#inputBtnID").attr('value', 'New Value');
});







$(function () {
         $("#inputBtnID").prop('value', 'New Value');
});






Here we can make use of jQuery html attribute for changing the text.

$(function () {
         $("#htmlBtnID").html('New Value');
});



That's all, by using above methods, we can change the text of button using jQuery.