Reputation: 1528
I am using jquery for input [type=submit] value changed.
I have four to five html <form>
. 2 forms which is on header and body its working as i want. But other 2 form which is on footer and contact us page it not working. I mean input value not changing. when i saw inspect element. Inspect element code showing value change but in front view value not changing.
My Jquery version is jquery-3.3.1.min.js
I tried this code:
$('#footer-btn').attr("value", 'Please wait..');
$('#footer-btn').prop("value", 'Please wait..');
$('#id input[type=submit]').prop("value", 'Please wait..');
$('#id input[type=submit]').attr("value", 'Please wait..');
**but same code two forms changed his input value and 2 others form not changing his input value Please solve the errros. **
Upvotes: 1
Views: 720
Reputation: 72299
Seems that you actually want to change button text, but you are doing it through .prop() or .attr()
using value
, which is incorrect.
To change the text of button,you need to use .html()
or .text()
$('#footer-btn').html('Please wait..');
$('#footer-btn').text('Please wait..');
Working snippet:-
$(document).ready(function(){
$('#footer-btn').html('Please wait..');
$('#footer-btn1').text('Please wait for 5 second..');
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<button id="footer-btn">Click Me!</button>
<button id="footer-btn1">Click Me too!</button>
Upvotes: 2