javascript - How to remove all tags after certain tag? - Stack Overflow

I need to remove tags going after #first and only in #container.How can I do it with jQuery?<div id

I need to remove tags going after #first and only in #container. How can I do it with jQuery?

<div id="container">
  <div id="first"></div>
  <div id="remove_me_1"></div>
  <div id="remove_me_2"></div>
  <div id="remove_me_3"></div>
  <a href="" id="remove_me_too">Remove me too</a>
</div>

Thank you

I need to remove tags going after #first and only in #container. How can I do it with jQuery?

<div id="container">
  <div id="first"></div>
  <div id="remove_me_1"></div>
  <div id="remove_me_2"></div>
  <div id="remove_me_3"></div>
  <a href="" id="remove_me_too">Remove me too</a>
</div>

Thank you

Share Improve this question asked May 12, 2010 at 10:19 KirzillaKirzilla 16.6k27 gold badges89 silver badges131 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 11

You can use nextAll method: http://api.jquery./nextAll/

$("#first").nextAll().remove();
$.("#container #first ~ *").remove();
$("#container :gt(0)").remove();

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744034760a4547212.html

相关推荐

  • javascript - How to remove all tags after certain tag? - Stack Overflow

    I need to remove tags going after #first and only in #container.How can I do it with jQuery?<div id

    9天前
    10

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信