What is the proper way to use an ampersand in the title attribute? I would have assumed that you should use &
, but it gives different behavior depending on whether it was set in the original HTML or modified with JS.
Tooltip rendering in Chrome (Version 47.0.2526.106 (64-bit)) and Safari (Version 9.0.2 (11601.3.9)):
https://jsfiddle.net/davegaeddert/femm9b96/
&
means &
in HTML.
&
means &
when you are directly manipulating the DOM using a DOM API.
If you aren't writing HTML, don't use HTML entities.
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