I am trying to create a validation script for a few selectors such as month, day, and year for your birthday. Basically I want the script to run as:
IF the selector is on the first option return false
ELSE return true
What is the IF statement I need in order to return the script false if the first option in the list is selected.
For example,
<select>
<option>FAIL IF THIS IS SELECTED</option>
<option>PASS IF THIS IS SELECTED</option>
<option>PASS IF THIS IS SELECTED</option>
...And So On
</select>
Also, Does any one know how to do this in PHP as well?
You want to use
selectedIndexto find out which item is selected.Example: http://jsfiddle.net/JtCvj/