As you now you need id or class to design an element lets suppose we want to add an extra li inside of ul into HTML page so we can add a class or id by simply attaching li with class or id and by giving it a class or id name
li. id = ‘ id name ‘
li.class = ‘ class name’
And now have to append the text node by simply attaching li with append and then attach it with the document.createTextNode( ” whatever text you want to show”) inside the curly brackets.
li.append(document.createTextNode( ” List Item”));
this is not enough know you need to append li inside the ul where you want to place it by simply writing the ul class inside brackets of document.querySelector and then attach it with append child ( ) and by adding li inside the append child’s brackets.
document.querySelector( “ul class name”).appendchild( li );
Now it’s all done the element will be added.