2012-07-02 3 views

답변

2

not() 방법을

$('a').not('.someClass').click(function() { 
    //your code here... 
}); 

를 사용해보십시오 : 당신은이 성능에 대한 더 나은 직접 필터링 할 not selector를 사용할 수 있습니다.

$('a:not(.someClass)').click(function() { 
    //your code here... 
}); 
+0

답변 해 주셔서 감사합니다! – Phil

0
$(function(){ 

    $('a').not('.yourClassToIgnore').click(function() { 
    //do somethng  
    }); 

}); 

Jsfiddle 샘플 : http://jsfiddle.net/S5XLv/2/

+2

-1은 무엇입니까? –

+0

감사합니다. 앤티 랫이 잠깐 너를 때렸어 :-) – Phil

2

당신은 jQuery를 :not 선택 사용할 수 있습니다

$("a:not(.some-class)").on("click", function(){ 
}); 

또는 .not() 기능

$("a").not(".some-class").on("click", function(){ 
}); 
관련 문제