I have:
<div id="container">
<div id="i_1"></div>
<div id="i_2"></div>
<div id="i_3"></div>
<div id="i_4"></div>
</div>
How do I remove everything after $('#i_2')?
使用nextAll
$('#i_2').nextAll().remove()
$("#container div:gt(1)").remove();
另一种选择。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.