下にあるすべてのアイテムをバインドしたいとしましょう
#mainDiv .user
を除外する
#mainDiv #exception .user
私は考えることができます
$('#mainDiv .user').bind('event',function(){
if($(this).parents('#exception').length>0){}else{
// do stuff;
}
});
また:
$('#mainDiv :not('#exception').find('.user').bind('event',function(){
if($(this).parents('#exception').length>0){}else{
// do stuff;
}
});
より良いものは何ですか?