Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

Remove all child nodes of a list:

// Get the <ul> element with id="myList"
let list = document.getElementById("myList");

// As long as <ul> has a child node, remove it
while (list.hasChildNodes()) {  
  list.removeChild(list.firstChild);
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: foreach jquery 
Javascript :: can i learn backend before frontend 
Javascript :: jquery get label from select 
Javascript :: newtonsoft json object to json string 
Javascript :: add option to select jquery 
Javascript :: Axios GET Req with Basic Auth 
Javascript :: select all checkboxes jquery 
Javascript :: mouseevent clientx javascript 
Javascript :: how to change the staticness of a object in matter.js 
Javascript :: javascript ascii to hex 
Javascript :: expo build 
Javascript :: add expiry to jwt extended token 
Javascript :: javascript object get element by index 
Javascript :: YT.Player is not a constructor 
Javascript :: check if element is last child jquery 
Javascript :: angular httpheaders example 
Javascript :: parse date do weekday 
Javascript :: javascript absolute import 
Javascript :: express serve static files 
Javascript :: how to add elements in javascript html 
Javascript :: js ask before close chrome 
Javascript :: you have no internet connection angular 
Javascript :: unable to resolve path to module eslint(import/no-unresolved) absoute path 
Javascript :: print webpage in javascript 
Javascript :: js make obj invisible 
Javascript :: js trigger click 
Javascript :: change header background color on scroll css 
Javascript :: javascript is variable number or string 
Javascript :: add class on javascript onclick function 
Javascript :: how to remove duplicates from array in javascript 
ADD CONTENT
Topic
Content
Source link
Name
4+5 =