Delete
The deletion operation is very simple. Just call the remove() method directly after the result set.
For example, to delete all a elements in the following html script, copy the code directly through
$('a'.remove();
That’s it.
Of course, you can also filter the selection results by passing parameters to remove, and then perform the remove operation
$('a').remove('.remove');
It should be noted that
The remove operation will not delete the elements that meet the conditions from the result set, so in theory you can continue to operate the "deleted" elements
The remove operation will not only "delete" the element and the data related to all elements will also be Delete (event handlers, internally cached data)
Replace
If you want to replace the li element with class remove with
removed, you can use the following two methods, etc. Price method
$('li.remove'). replaceWith('
removed);
$('removed;).replaceAll('li.remove');