I am using css media queries on my site and I have used display: none to hide some elements. Although this does the trick in terms of completely hiding the element it still remains in the DOM. Are there any methods that I can use to completely remove the element from the DOM also?
Share
element.parentNode.removeChild(element)is the universal method to remove DOM nodes from.The JQuery method:
$("selector").remove()Example: