Disabling Several Submit Buttons, Leaving Just One Enabled
I have a number of similar forms on a page, created by a PHP while loop. Each form has about 10 text inputs and a submit button. If (just for this question) the forms are called A, B, C and D, I want to disable the submit buttons on B, C and D when one of the inputs on A is in focus. And likewise for each of the other forms.
My thought for doing this is to have two lines of jQuery. The first line will disable all the submit buttons. The second line wil re-enable the one with the focus on the input. I can do the first part of that but I am stuck with the second part.
Each form is
- <form action="<?php echo $_SERVER['PHP_SELF'] ?>" method="post" name="changeform">
and each submit button is
- <input name="changebutton" type="submit" value="Change">
Then my script is
- $("input").focus(function(){
- $("input[name=changebutton]").attr("disabled", "disabled");
- $("this.input[name=changebutton]").removeAttr("disabled");
- });
Clearly line 3 there is wrong, but what should it be?