I got a plugin
$.fn.dropDown = function(options){
this.each(function(){
var $this= $(this);
$(document).click(function(e){
开发者_如何学JAVA if($(e.target).not($this) && $(e.target).not($this).find('*')){
// do stuff
}
});
});
}
I want to select "not this and not everything in this" ,so far, that doesn't work.
This should work:
var that = this;
$(document).click(function(e) {
if( e.target != that && !$.contains(that, e.target) ) {
// do stuff
}
});
精彩评论