I am trying to stop a submit button to be clicked multiple times and upload the same item multiple times to MySQL.
Because the validation doesn\'t work, I can not pre
Here is a fiddle that has a working demo of solution to your problem.
To change the disabled property you should use the .prop() function.
$("#submit").prop('disabled', true);
$("#submit").prop('disabled', false);
The .prop() function doesn't exist, but .attr() does similar:
Set the disabled attribute.
$("#submit").attr('disabled','disabled');
To enable again
$("#submit").removeAttr('disabled');
You can always rely on the actual DOM object and is probably a little faster than the other two options if you are only dealing with one element:
// assuming an event handler thus 'this'
this.disabled = true;
The advantage to using the .prop() or .attr() methods is that you can set the property for a bunch of selected items.