0

I am using a drag & drop functionality where i drag item and dropthe text in droppable item.

Draggable Item :

 <li id="test" data-text="Test \n Drag"><label>Test Drag</label></li>

Droppable Item :

<textarea id="testtextarea"></textarea>

I want to drop text from draggable item with carriage return

Means Output would be
Test is first line and drag in Second line

I am using following Jquery

$("li").draggable({
   // snap: false, snapMode: 'both', revert: false,
    appendTo: "body",
    helper: "clone",
    zIndex: 100,       
}); $("#testtextarea").droppable({
        drop: function (event, ui, e) {
            $("#testtextarea").val($("#test").attr("data-text"));
        } });

jsfiddle Demo

Cœur
  • 37,241
  • 25
  • 195
  • 267
Jankya
  • 966
  • 2
  • 12
  • 34

1 Answers1

0

Just check if THIS is what you are looking for. You have to modify your data-text attribute as below

<li id="test" data-text="Test &#13;Drag">
       <label>Test Drag</label>
</li>
<textarea id="testtextarea"></textarea>

SOURCE

Community
  • 1
  • 1
Guruprasad J Rao
  • 29,410
  • 14
  • 101
  • 200