I have multiple form elements on a page and I have a next button for each form. I fill a form and click on next button to scroll to next form. I want that after filling up a form when user clicks next button it should disable all elements of previous elements.
What I tried:
I assigned unique id
to all forms and tried following
$('form #firstFrm').find('input').attr('disabled','disabled');
But it did not do anyything.
$("#firstFrm> input").attr("disabled", true);
but not effect.
$("#firstFrm :input").attr("disabled", true);
for this instead of disabling elements under form
with id
firstFrm it disable elements of all form.
how to disable elements of particular form only.
HTML Code
<form action="" method="post">
<fieldset class="sectionwrap">
<legend style="padding-right: 425px;">User Details</legend>
<fieldset class="column" style= "width: 500px;margin-top: 10px;">
<div id="firstFrm">
<table style="padding-right: 20px; float: left">
<tr>
<td id="targetTD">
Username : <input id="email" type="email" name="email"/>
</td>
</tr>
<tr>
<td>
Password : <input id="password" name="password" type="password" class="text" />
</td>
</tr>
<tr>
<td>
password : <input id="confirmPassword" name="confirmPassword" type="password" class="text" />
</td>
</tr>
</table>
</div>
</fieldset>
</fieldset>
</form>
Solution
I created div
under form
and put all elements in that div
and instead of disabling elements under form
I disabled elements under div
. This worked fine.