重新启用文本选择(Opera,webkit,ie)

时间:2012-08-05 18:16:16

标签: javascript jquery textselection

如何在IE,Opera和&amp ;;上重新启用文本选择的Webkit?

我这样禁用了它:

$(this).mousedown(function(){return true;}); //Opera, webkit
$(this).bind('selectstart',function(){return true;}); //IE

(使用firefox,我可以使用$(this).css('MozUserSelect','text')轻松重新启用它;

2 个答案:

答案 0 :(得分:2)

我认为最好的办法是unbind事件监听器。

答案 1 :(得分:1)

请勿使用bind()unbind()方法。请改用on()off() - 首选jQuery 1.7及更高版本。