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 on开发者_如何学JAVAe 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.
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.
精彩评论