If you prefer not to use JQuery:
function removeElementsByClass(className){
const elements = document.getElementsByClassName(className);
while(elements.length > 0){
elements[0].parentNode.removeChild(elements[0]);
}
}
More Related Contents:
- compare each 5 numbers of two array [closed]
- JavaScript Syntax error
- Javascript if statement says 63>542 is true
- How to check if two arrays are equal with JavaScript? [duplicate]
- AngularJS ui-router login authentication
- Why can I access TypeScript private members when I shouldn’t be able to?
- How to pass parameter to function using in addEventListener?
- How to convert a DOM node list to an array in Javascript?
- ScriptManager.RegisterStartupScript code not working – why?
- Selecting multiple classes with jQuery
- Getting unparsed (raw) HTML with JavaScript
- Is there any cross-browser javascript for making vh and vw units work
- Recommended way of making React component/div draggable
- React: trigger onChange if input value is changing by state?
- javascript large integer round because precision? (why?)
- Set default value for a input file form [duplicate]
- Javascript Redirect with Google Analytics
- Change CSS of class in Javascript?
- Bitshift in javascript
- Using Multiple page.open in Single Script
- Convert HTML Character Entities back to regular text using javascript
- jQuery plugin DataTables: How to highlight the current search text?
- Add CSS rule via jQuery for future created elements
- jQuery continuous mousedown
- Cancel click event in the mouseup event handler
- How are JavaScript arrays implemented?
- React Error: “SharedArrayBuffer is not defined” in Firefox
- MediaElementAudioSource outputs zeroes due to CORS access restrictions
- Is there a purpose to hoisting variables?
- How to replace the entire html webpage with ajax response?