Question

I'm trying to change the element of the item I'm dragging using the helper functionality I have the following example (which is not working): jsfiddle

The following code seems to work:

$('#original').draggable();
$('#clone').draggable({helper: 'clone' });

But if I change "clone" to the following:

$('#clone').draggable({helper: function(e,ui) { return $(ui).clone().html("<p>clone</p>"); }});

It's having issues.

Any help would be appreciated. Thanks

Was it helpful?

Solution

Try : http://jsfiddle.net/lotusgodkk/Uxfnc/1/

Update:

$('#original').draggable();
$('#clone').draggable({
    helper: function (e, ui) {
        return $(this).clone(true).html("<p>clone</p>"); //Replaced $(ui) with $(this)
    }
});

Hope it helps.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top