This article mainly introduces how to delete subnodes created by javascript, involving the operation skills of javascript For page node elements, for more information about how to delete subnodes created by javascript, see the example in this article. Share it with you for your reference. The details are as follows:
The node created by js does not know how to delete it at the moment... It took a lot of time
For (var I = 0; I <jsonList. length; I ++) {var li_button = document. createElement ("li"); li_button.className = "button"; var li_button_a = document. createElement ("a"); li_button_a.id = jsonList [I]. _ id; var li_button_text = document. createTextNode (jsonList [I]. projectName); li_button_a.appendChild (li_button_text); li_button.appendChild (li_button_a); ul_level2.appendChild (li_button );}
Later I learned that the node is actually
The content of innerHTML = ''In ul_level2.innerHTML ='' In ul_level2.innerHTML = ''can be cleared as long as it is empty.
I hope this article will help you design javascript programs.