Using the example here as a starting point, I set out to customize my draggable and sortable data. In the linked example, we have simple text in the draggable. I replaced it with a select tag.
When dragging the select element into the sortable, I would like to use only the value of the selected option when moving it to the sortable list. To this end, I use the custom helper, but unfortunately, as soon as I drop it, it turns into a select element again.
$("#draggable").draggable({
connectToSortable: "#sortable",
opacity: 0.8,
cursor: "move",
helper: function () {
return $("<div>" + $(this).text() + "</div>");
},
distance: 20
});
How can I fix this? Thanks for looking. JSFiddle is here:
PS: Removing all the classes from droppable didn't help either, and affects when sorting within the group as well, so this is the wrong approach
$("#sortable").droppable({
drop: function (event, ui) {
alert('dropped');
$(ui.draggable).removeClass();
},
activeClass: "ui-state-hover",
hoverClass: "ui-state-active"
});