I must say I am really confused, I have been reading articles on what is allowed and not when giving HTML elements, IDs.
I want to use:
<input type="checkbox" class="checkbox" id="my-option" name="my-option" />
Is it safe to use dash/hyphen in the ID? It doesn't generate an error for me but I've read some people saying JavaScript could treat "my-option" as "my minus option".
Are dashes/hyphens safe for ID names?
Moderator: General Moderators
-
Charles256
- DevNet Resident
- Posts: 1375
- Joined: Fri Sep 16, 2005 9:06 pm
Re: Are dashes/hyphens safe for ID names?
Not if it's in quotes as it should be. At least to the best of my knowledge. If someone knows otherwise a demo would be great.