Weird selectors

Weird selectors

Hello. I have got a problem with selectors. I am trying to get them to work for quite a while now.

Here is what I got.

$("a:not([@rel*=lightbox]),a:not([@href^=javascript])").click(function() {
  // stuff
});


I want to apply that function ONLY to anchors without rel and href which does not start with javascript, but here goes my problem. It works only if I have either
a:not([@rel*=lightbox])
or
a:not([@href^=javascript])

Never with both.

Any suggestions would be appreciated.

Regards