I need to place html in javascript. Specifically, I would like to add an HTML link to a div tag with javascript.
html:
<div id="mydivtag"></div>
javascript:
document.getElementById('mydivtag').innerHTML = "<li><a href=\"someLink\">Some Link</a></li> ";
Am I formatting the html link I am adding through javascript correctly?
Looks fine and works here. You may want to consider mixing single quotes instead of escaping the double quotes, but that's just a preference.
document.getElementById('mydivtag').innerHTML = "<li><a href='someLink'>Some Link</a></li>";