I have a list of <li> items that are dragged using jQuerys drag/drop. I’d like to grab the text within the <li> tag just when the item is dropped, append the text to a global variable so that selected values can be submitted to a servlet.
To handle the functionality when the item is dropped I can use below jQuery callback :
stop: function(event, ui) {
//update variable here
}
How can I grab the text value within the <li> tag and append it to a global variable ?
Thanks
You can use
ui.draggable.text()in thedropevent of droppable.Or
ui.helper.text()in thestopevent of draggable.