Reputation: 21
I want the users of my application to be able to highlight text from a textarea
and drag and drop it into a text input
.
I want to change the default behavior (the user shouldn't have to hold down CTRL or ALT) to copy the text rather than being moved from the textarea to the input.
I've already tried using jQuery Draggable
and Droppable
. I could see how this would work if a div
or a static static would be selected and a helper clone was used, but I don't know how to do it with a random text selection in a textarea
.
Upvotes: 2
Views: 2358
Reputation: 1294
You could try the following hack:
div
and copy the selected text into it, with something like 'window.getSelection'div
, populate the input
field and clear the div Upvotes: 1