You've got a bunch of tabs inside each of the li
elements, around the text, and they are getting copied as well.
Change the php so there are no tabs...
<li id="node" runat="server"><?php echo $t['name'] ?></li>
Alternatively, change the drop
function to this...
drop: function (event, ui) {
var $this = $(this);
if ($this.val() == '') {
$this.val(ui.draggable.text().trim());
} else {
$this.val($this.val() + "," + ui.draggable.text().trim());
}
}
Notice I've added trim()
to get rid of leading and trailing whitespace.