remove an element from html using javascript code example

Example 1: javascript remove html element

const labelEmail = document.getElementById('label-email');
labelEmail.remove();

Example 2: js remove html element

// Get the element you want to remove
var element = document.getElementById(elementId);

// Get the parent and remove the element since it is a child of the parent
element.parentNode.removeChild(element);

Example 3: javascript remove element from the dom

node.remove();

Example 4: remove in javascript

function arrayRemove(arr, value) 
{
  return arr.filter(function(ele){ 
    return ele != value;
  });
}
//var result = arrayRemove(array, 6);// result = [1, 2, 3, 4, 5, 7, 8, 9, 0]

Tags:

Php Example