How to set elements html content from a string using JS?
Before:
<div id="foo"></div>
开发者_C百科After:
<div id="foo"><a href="www.stackoverflow.com">best site eva</a></div>
How to accomplish this with pure JS (no jQuery)?
There are a number of ways, probably the simplest is
document.getElementById("foo").innerHTML = '<a href="www.stackoverflow.com">best site eva</a>';
精彩评论