Chuck Callebs
Chuck Callebs

Reputation: 16431

Drag and Drop Element Into Textbox

In the latest project I'm undertaking, I need to be able to drag a div element from a list and drop it into a textbox. The project itself has a strong messaging component and I'd like to have the functionality to drag contacts from a contact list and place them in a "recipient" textbox containing one or more recipients, comma delimited.

I've figured out dragging and dropping from here, but I can't for the life of me figure out a way to populate a textbox by dropping a div item onto it.

I'd appreciate any assistance.

Upvotes: 2

Views: 8360

Answers (1)

Nate Pinchot
Nate Pinchot

Reputation: 3318

I made a jsfiddle that uses jQuery and jQuery UI to achieve what you were looking for. In my example I replace the contents of the text box on drop, but you could easily alter this to append.

Upvotes: 7

Related Questions