I'm using a PHP script to set a class on a particular select
item if nothing has been selected from the list (form validation
routine).
It works fine in IE, but doesn't in Firefox and Netscape -
apparently something I'm doing wrong.
Maybe I'm putting the class in the wrong place? Maybe my
element hook (select option.error) is wrong?
I can't figure it out.
Here's a snippet of the source from the select list (Class
position shown in red):
<td
class="label">Country:</td><td>
<select name="country" size="1"> <option value="0" class="error">Choose your country:</option> <option value="Argentina">Argentina</option> <option value="Australia">Australia</option> <option value="Austria">Austria</option> <option value="Bahamas">Bahamas</option> <option value="Belgium">Belgium</option> </select> </td>
Real easy - if someone doesn't choose a country from the list,
the validation routine sets the class of the default option (Choose
your country:) to class "error" which is suppose to turn the background of that
line light red.
Here's the rule:
input.error, select option.error, textarea.error
{
background-color: #FFD0DC; } Like I said, it works perfect in IE, color doesn't change,
however, in FF or Netscape.
Can anyone see what I'm doing
wrong?
|
- [WSG] Setting a class for a Select Option list Cole Kuryakin - x7m