I want to re-enable the selection

this was the disable:

function AttIvAselecT(){
$('*').attr('unselectable','on')
 .css({'-moz-user-select':'-moz-none',
       '-moz-user-select':'none',
       '-o-user-select':'none',
       '-khtml-user-select':'none',
       '-webkit-user-select':'none',
       '-ms-user-select':'none',
       'user-select':'none'
 }).bind('selectstart', function(){ return false; });

};

有帮助吗?

解决方案

As detailed in the specification for this non-standard feature, you can use none | text | all | element

So in your case:

function UNDO_AttIvAselecT(){
    $('*').attr('unselectable','off')
    .css({'-moz-user-select':'-moz-all',
       '-moz-user-select':'all',
       '-o-user-select':'all',
       '-khtml-user-select':'all',
       '-webkit-user-select':'all',
       '-ms-user-select':'all',
       'user-select':'all'
    }).unbind('selectstart');
};

其他提示

Based on UNSELECTABLE and user-select

$('*').attr('unselectable','off')
 .css({'-moz-user-select':'text',
       '-moz-user-select':'text',
       '-o-user-select':'text',
       '-khtml-user-select':'text',
       '-webkit-user-select':'text',
       '-ms-user-select':'text',
       'user-select':'text'
 }).unbind('selectstart'); // don't miss to unbind it

Fiddle

FYI:

what @A.Wolff says, * represents the entire html elements. so it is not wise to unselect all html elements, instead use if or class selector

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top