Search code examples
jquerycssz-indexdragsort

How to permit text selection on jQuery List DragSort elements


I am using the dragsort plugin for dragging elements, but when I use the plugin, I can't select the area where I use dragsort for dragging.

I selected the list area to drag my p element with span which has drag class;

var newitem ='<p >'+'<span class="drag">DRAG|</span> '+ userList +'</p>';
$('#list').append(newitem);

.

$("#list").dragsort({  dragSelector: ".drag",});

I looked plugin source and saw that z-index is 999.Took a screenshot.You can also take a look source code from here. I used z-index:1000; for my element in my css but it did not work.

What is the solution ?

JSFIDDLE


Solution

  • The problem is not about the z-index value of the element.

    To permit text selection with this plugin you should remove the e.preventDefault(); in the source code (t.preventDefault(); in the minified version) that affects the base behaviour of the text selection on the browser. fiddle here