Try putting everything in the main selector:
Example: http://jsfiddle.net/8Tkex/
jQuery("a:not(div#mnuMain a)").live("click", function(event){
event.preventDefault();
alert("yes I got u");
});
EDIT:
The reason for using it .not()didn’t work, because when using the jQuery method live(), you don’t actually place the click handler on the element. Instead, you put it at the root of the document.
This works because all the clicks (and other) events on the page “bubble” from the element that actually received the event, right down to the root, thereby firing the handler that you placed in the root using .live().
, jQuery , , , ( ) . selector, .live().
, :
jQuery("a").live("click", func...
... jQuery "a" click.
, :
jQuery("a:not(div#mnuMain a)").live("click", func...
... jQuery "a:not(div#mnuMain a)" .
jQuery("a").not("div#mnuMain a").live("click", func...
... "a.not(div#mnuMain a)", , <a> .not.
, live(), .not() .
- , jQuery, , . selector, jQuery.
var $elem = jQuery("a").not("div#mnuMain a");
console.log( $elem );
... - :
Object
context: HTMLDocument
length: 0
prevObject: Object
selector: "a.not(div#mnuMain a)"
__proto__: Object
, Safari.