Issue
I want to create a nested tag using javascript createElement function like
<li><span class="toggle">Jan</span></li>
Can anyone give me an idea how to do it?
Solution
The simplest way is with createElement() and then set its innerHTML:
var tag = document.createElement("li");
tag.innerHTML = '<span class="toggle">Jan</span>';
You can then add it to the document with .appendChild() wherever you want it to go.
Answered By - jfriend00
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.