Jump to content

I get error when the option element is empty


etsted

Recommended Posts

I have a simple drop down select list, but when one of the option elements is empty

<option value=""></option> or <option></option>

I get an error when i try to validate the script:

error.png Line 213, Column 17: Element option without attribute label must not be empty.

<option></option>
Link to comment
Share on other sites

It looks like an empty option element is not permitted in HTML I notice people using   as text content

<option value=""> </option>

When I want a default option I usually use a dash:

<option value=""> - </option>
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...