I have a form that submits via Ajax. After the user submits the form, the text changes displaying the form were submitted successfully, and then the completed forms are displayed. I want to display the form, but I do not want them to resubmit the form, so I want to disable the inputs, as well as the submit button. I tried adding: $('#submit_btn').className +=" disabled" in ajax script, but it just refreshed the page without sending anything.
The ajax script looks like this:
$(function() { $('.error').hide(); $('input.text-input').css({backgroundColor:"#FFFFFF"}); $('input.text-input').focus(function(){ $(this).css({backgroundColor:"#FFDDAA"}); }); $('input.text-input').blur(function(){ $(this).css({backgroundColor:"#FFFFFF"}); }); $(".button").click(function() {
How can I disable the inputs and the button after the successful submission of the form?
http://jsfiddle.net/gY9xS/
source share