With jQuery, I'm trying to disable an input field like this:
<input id="submit" type="image" src="submit.jpg">
What I would like to do is disabling the button and change the image with a different image (submitGreyed.jpg) to visually notify that button is disabled.
With the following line I disable the button:
JQuery("#submit").attr('disabled','true');
then I change the image with:
JQuery("#submit").attr('src','submitGreyed.jpg');
and once disabled I submit the form with:
JQuery("#form").submit();
The second line has some weird behaviour; sometimes works and sometimes doesn't.
When it works, button is disabled, image changed and form is submitted; when it does not work, button is disabled, form is submitted but image is not changed.
How can I solve this?