Aaron Yodaiken
Aaron Yodaiken

Reputation: 19551

Are there any invalid values from id that use only [a-z0-9]?

I'm generating IDs for elements in a page, and would like to make sure I don't stumble across some invalid 'id' value. While the W3 standard seems to say that anything goes, you never know about all browsers, etc, so I'm asking here.


I'm talking about id as in <div id='myid' />.

Upvotes: 0

Views: 75

Answers (1)

kei
kei

Reputation: 20491

ID (and NAME) tokens must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods (".").

From: http://www.w3.org/TR/html4/types.html

Upvotes: 1

Related Questions