As stated in, When did single quotes in HTML become so popular? and Jquery embedded quote in attribute, the Wikipedia entry on HTML says the following:
The single-quote character ('), when used to quote an attribute value, must also be escaped as
'or'(should NOT be escaped as'except in XHTML documents) when it appears within the attribute value itself.
Why shouldn't ' be used? Also, is " safe to be used instead of "?
" is on the official list of valid HTML 4 entities, but ' is not.
From C.16. The Named Character Reference ':
The named character reference
'(the apostrophe, U+0027) was introduced in XML 1.0 but does not appear in HTML. Authors should therefore use'instead of'to work as expected in HTML 4 user agents.
" is valid in both HTML5 and HTML4.
' is valid in HTML5, but not HTML4. However, most browsers support ' for HTML4 anyway.
' is not part of the HTML 4 standard.
" is, though, so is fine to use.
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