I have a list and some input fields. I want to drag the list item into the input field, and in the update callback, get the target input field - because I want to copy the text of the list item into the value attribute of input field. I also don't want the list item to disappear from its original location. This is what I have done:
<ul id="field_source">
<li>some text</li>
<li>some other text</li>
</ul>
<ul class="designer_row connectRow">
<li>
<input type="text" class="connectColumn" /><input type="text" class="connectColumn" />
</li>
</ul>
$( "#field_source, input" ).sortable({
connectWith: ".connectColumn",
forcePlaceholderSize: false,
helper: function(e,li) {
copyHelper= li.clone().insertAfter(li);
return li.clone();
},
stop: function(event, ui) {
copyHelper && copyHelper.remove();
},
update: function(event, ui){
// both ui.item and this are giving me the item dragged, not the element dropped on (the input field)
}
})
How can I figure out which input field was targeted?