3

我总是浪费很多时间或者这个,我需要在 jQuery 中快速反转选择器吗?

Everything but $('.example');

我什至试过

$(':not(.example)')

4

1 回答 1

4

我想这就是你要找的东西:

$("body").on("click", function() {
    // close div
});

$("#element").on("click", function(e) {
    e.stopPropagation();
    // open div
});

演示:http: //jsfiddle.net/NamAJ/

于 2013-05-31T09:13:04.443 回答