4 ms·
new Option("<div>in the browser, yes.</div>").innerHTML
by jedschmidt 14y ago
new Option("<div>in the browser, yes.</div>").innerHTML
- jasonmoo 14y agoOh I like this. I was messing with a similar tactic appending a textNode to an HTML element but this is much more elegant.
- jedschmidt 14y agoThe text node approach is cross-browser, whereas I don't think this works on oldIE.
- jsharpe 14y agoI just tried this and it doesn't seem to escape " to ".
- jfaucett 14y agoyes! awesome snippit :)