views:

43

answers:

2

Hi I am using the JQuery plugins Draggable and droppable and this is my draggable item structure .

The Textbox value is the qty of the item being dropped onto a shopping cart. This will be changed by the user before he drops it onto the cart section. I need to capture this value after its dropped.

 <div class="something">
    <ul>

     <li>


            TEXTBOX 1

     </li>
    </ul>

    <div>
A: 

If you're dragging the form into another div on the drop function you'd want to reference the dropped item. You'd need to setup your drop area similar to this in order to get that items value.

$("#dropArea").droppable({drop: function(event, ui) {
        var num = ui.draggable.val();
    }
})

The ui.draggable would be the dragged element.

I didn't test the code with the .val() but I know this is how you would get the element being dropped so play around with it.

bryall
A: 

Hi,

I should have been a little more detailed in my question. Actually the trouble was that within that UL I had a ListViewDataItem which would get rendered as a LI ofc. And in each LI I had multiple controls of which one was this TExtBox1.

I figured out that in the "drop:function(...){}" I would use the $(ui).find(".className") to find the textBox1 which had a particular class and then used its value property to get the qty I wanted :)

Thanks for the help :)

Sandy