In jQuery 1.8, this can be done as follows:(在jQuery 1.8中,可以按如下方式完成:)
(function($){
$.fn.disableSelection = function() {
return this
.attr('unselectable', 'on')
.css('user-select', 'none')
.on('selectstart', false);
};
})(jQuery);
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…