Usually HTML element attribute values are marked with a quotation mark, like
<input type="hidden" value="test" />
Sometimes, however, you see code like
<input type='hidden' value='test' />
Is it valid HTML and can it cause any problems? What about mixing the two, like
<input type='hidden' value="test">
?
The linked question from James Allardice's comment to my original question lead me to the answer: yes, apostrophes are valid containers for HTML element attribute values.
Specification: On SGML and HTML
By default, SGML requires that all attribute values be delimited using either double quotation marks (ASCII decimal 34) or single quotation marks (ASCII decimal 39). Single quote marks can be included within the attribute value when the value is delimited by double quote marks, and vice versa.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With