jQuery - Multiple Selectors in a :not()?

后端 未结 3 946
攒了一身酷
攒了一身酷 2021-02-03 17:58

I cant seem to get the following working:

$(\'input:not([type=radio][type=checkbox])\').live(\'click\', function() {
    alert(\"You haven\'t clicked a radio or          


        
3条回答
  •  别跟我提以往
    2021-02-03 18:19

    You're confusing the multiple selector with the multiple attribute selector. You should write:

    $("input:not([type=radio], [type=checkbox])");
    

    The multiple attribute selector [type=radio][type=checkbox] matches the elements whose type attributes are equal to both radio and checkbox, which cannot happen in this universe.

提交回复
热议问题