.not
accepts a selector, including a selector group. So:
$('a').not('[href="#"], [href="#navShow"], [href="#navHide"], [href="#about"]').click(function () {
});
Or with :not
instead (CSS docs, jQuery docs):
$('a:not([href="#"]):not([href="#navShow"]):not([href="#navHide"]):not([href="#about"])').click(function () {
});
(Unlike .not
, :not
cannot accept a selector group, only a simple selector. But we can chain them within the overall selector.)
That said, you might consider adding a class to the a
elements you do or do not want selected for this, and using that class (with or without not
depending on which way you go) instead of doing this href
check individually.