Question

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; });

};

Était-ce utile?

La solution

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');
};

Autres conseils

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

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top