How does jquery remove an element from the end
This article shows you how jquery removes an element from the end, which is concise and easy to understand, which will definitely brighten your eyes. I hope you can learn something from the details of this article.
Removal method: 1, using "eq (- 1)" selector and remove () method, syntax "$(Element). Eq (- 1). Remove ()"; 2, using ": last" selector and remove () method, syntax "$(Element:last). Remove ()".
The operating environment of this tutorial: windows7 system, jquery1.10.2 version, Dell G3 computer.
Jquery removes an element from the end
Method 1: "eq (- 1)" selector + remove () method
Use the "eq (- 1)" selector to select the last element from the end
Delete the selected element using the remove () method
$(document) .ready (function () {$("p"). Eq (- 1). Remove ();})
The first paragraph
The second paragraph
The third paragraph
The fourth paragraph
The fifth paragraph
The sixth paragraph
Method 2: ": last" selector + remove () method
Use the ": last" selector to select the last element from the end
Delete the selected element using the remove () method
$(document) .ready (function () {$("p:last") .remove ();})
The first paragraph
The second paragraph
The third paragraph
The fourth paragraph
The fifth paragraph
The above is how jquery removes an element from the end. Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.