jQuery - Remove Elements
With jQuery, it is anything but difficult to evacuate existing HTML elements.
To evacuate components and substance, there are essentially two jQuery methods:
- remove() - Removes the chose component (and its kid elements)
- empty() - Removes the youngster components from the chose element
jQuery expel() Method
The jQuery expel() technique evacuates the chose element(s) and its tyke elements.
jQuery void() Method
The jQuery void() technique expels the kid components of the chose element(s).
Filter the Elements to be Removed
The jQuery expel() strategy likewise acknowledges one parameter, which enables you to channel the components to be removed.
The parameter can be any of the jQuery selector syntaxes.
The following precedent evacuates all <p> components with class="test":
This precedent evacuates all <p> components with class="test" and class="demo":