JQuery – Multiple Selectors in a :not()

jqueryjquery-selectors

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 checkbox!");
});

Have tried a few different syntax's, can anyone help me out on this one.

Cheers
Charlie

Best Solution

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.