how to disguise the droppable shopping cart if parents div are different and how to drop element as per parent element?

98 views Asked by At

i developed drag and drop element in fiddle but there is one problem i don't knoew how to disguise it by parent element

I have common jQuery function and two div tags. Both div tags have different names but both containing elements of identical ids and classes now i want to use this common Jquery function for them both? I have implemented common function but it's not working for both.

here is my fiddle jsfiddle.net/Er2Ef/9/ in my fiddle you can see that there is two div newdiv and newdiv2 they conduct identical element which have same class and id but i want some amd same shopping cart so my problem is that if i pick post 3 then post1 element also blink and same things for post2 and post4 so how can i code that allows only parent element to put and blink at particular place?? some body please help me here is my problem image problem image

1

There are 1 answers

2
TCHdvlp On BEST ANSWER

In this fiddle, I have just modifyed the binding between posts and droppable area using unique IDs. For more readability, a function makes the binding and is called for each pair post/drop

    function attachPostToBank(i){
        var bankable = "bank"+i;
        $("#"+bankable).droppable({ ...

http://jsfiddle.net/TCHdevlp/Er2Ef/12/