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');
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn