To add li element in ul I have done this...
var ul = document.getElementById('ul-id');
var li= document.createElement("li");
li.appendChild("some text here");
ul.appendChild(li);
But its giving error in my console. I am not getting what is the problem with this code. Any help will be appreciated.
Error:
Error: NotFoundError: DOM Exception 8
code: 8
message: "NotFoundError: DOM Exception 8"
name: "NotFoundError"
stack: "Error: An attempt was made to reference a Node in a context where it does not exist.
Thanks!