jquery remove removing from another element

前端 未结 4 1086
清酒与你
清酒与你 2021-01-23 15:58

According to here, jquery\'s remove function should work like so..

$(\'div\').remove(\'selector\'); 

Which I\'m trying in this example.

4条回答
  •  难免孤独
    2021-01-23 16:28

    You should use the following:

    $('p').remove('.unwanted');
    

    Argument in remove works as a filter. So here, you first select all

    elements and then remove only those which have class unwanted.

    DEMO: http://jsfiddle.net/qwXSw/1/

提交回复
热议问题