I have a list that I want to make sortable. I did this using jQuery UI Sortable. I want to use a custom placeholder for the position that the list item can be discarded. I cannot figure out how to create a placeholder that is a clone of the element to be sorted. Instead of an empty placeholder, I would like to show the cloned object to be sorted, so you get a kind of βpreviewβ, so to speak.
In short, ui.item [0] .outerHTML is what I want to use as a custom placeholder, I just can't figure it out.
<script> $(function() { $( "#menu" ).sortable({ start: function(event,ui) { console.log(ui.item[0].outerHTML); }, placeholder: { element: function(event,ui) { console.log(ui.item[0].outerHTML); } } }); $( "#menu" ).disableSelection(); }); </script>
Above was what I have now, but it does not work. Is there an easy way to do this with just sortable ones?
source share