Remove a HTML element using Id

 

To remove  element from HTML first select the element using document.getElementById() method this will return the HTML element then Call the remove() method on the selected object of HTML. Remove method will remove element from HTML

 

const someElement = document.getElementById('someElement');

someElement.remove();

Tags:

Share:

Related posts