How to remove all elements in a div after a certain div

后端 未结 5 1229
既然无缘
既然无缘 2021-01-20 04:31

So I have a div that is drawing in dynamic elements at its bottom and I want to hide these elements, no matter what their IDs are using javaScript/jQuery. Basically my HTML

5条回答
  •  抹茶落季
    2021-01-20 05:15

    If the script tag is always before the div's that need removing you could do this -

    $('.right-panel > script').nextAll('div').remove();
    

    http://jsfiddle.net/w6d8K/1/

    Based on what you tried you could do this -

    $('#the-form').nextAll('div').hide();
    

    http://jsfiddle.net/w6d8K/2/

    Here are the docs for nextAll() - https://api.jquery.com/nextAll/

提交回复
热议问题