“All but not” jQuery selector

后端 未结 7 1362
谎友^
谎友^ 2020-12-05 16:44

I can select (using jQuery) all the divs in a HTML markup as follows:

$(\'div\')

But I want to exclude a particular div (say h

7条回答
  •  粉色の甜心
    2020-12-05 17:27

       var elements =  $('div').not('#myid');
    

    This will include all the divs except the one with id 'myid'

提交回复
热议问题