I have a simple form with four select fields. If YES is selected on any form field, the submit button needs to be disabled and a hidden div should appear. Here’s an example of my markup:
<form>
I have read the information on the product(s)<select name="field4"> <option value="Yes">Yes</option> <option value="No">No</option> </select>
Do you have any allergies to any ingredients in product(s)?
<select name="field5"><option value="Yes">Yes</option> <option value="No">No</option> </select>
Are you pregnant?
<select name="field6"> <option value="Yes">Yes</option> <option value="No">No</option> </select>
Have you ever used this type of product and had undesirable results?
<select name="field7"> <option value="Yes">Yes</option> <option value="No">No</option> </select>
<input name="cmdSubmit" type="submit" value="Submit" />
</form>
<div style="display:none;">Hidden div only to appear if any of the four dropdowns are marked YES.</div>
Thanks for your help on this one. I am a jquery novice trying my best to learn.
I don’t completely understand the business logic of the way you have the form built and your requirements but… going based on what you have said here is what I would do.
.
with slightly modified HTML:
Example webpage:
http://mikegrace.s3.amazonaws.com/forums/stack-overflow/example-disable-submit-dynamically.html
On load:
all options ‘No’ but one:
all options ‘Yes’: