I know that in HTML4 classes and id cannot start with numbers.
I am coding in HTML 5/php and alot of my ids and classes have just numbers in them that point to a primary key in my database for jquery ajax calls.
I cannot find the documentation for HTML5 classes and id spec. Is it valid in HTML 5 to have class and id names such as,
class="122"
id="13213"
I have ran my output code through w3c conformance checker and all is good, but still I would like confirmation!?
Thanks
I’ve researched this thoroughly and wrote about my findings: The
idattribute got moreclassy in HTML5. From that article:To target a classname or ID that starts with a digit in CSS or in JavaScript using the Selectors API, you should escape them. For example, to target the element with
id="404", you can’t just use#404— you’d have to escape it as follows: