I am looking to use jQuery’s “disableSelection()” function because I have a lot of drag and drop on the pages but I do not want to disable selection on input boxes, just everything else.
I have tried
$('body').disableSelection(); $('input').enableSelection();
$('body').not('input').disableSelection();
still DISABLES EVERYTHING ON THE PAGE. Thank you.
With
You disable selection on every instance of
bodythat is not aninput. Since body is not an input this will just disable selection on body.Try this:
However, like other people pointed out it’s probably pretty useless disabling selection on things that aren’t draggable in the first place. So maybe you should replace
bodywith.dragor however you can select all the objects that are draggable (keeping the rest of the function the same).