Answers for "delete a element in js"

4

remove div javascript

var div = document.getElementById('div-01');
div.remove();
Posted by: Guest on June-16-2020
1

js delete element

// delete an element from the dom
var elem = document.querySelector('#some-element');
elem.parentNode.removeChild(elem);


// keep element in dom
var elem = document.querySelector('#some-element');
elem.style.display = 'none';
Posted by: Guest on September-10-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language