I am creating a question type for a survey.
I am using the below jsfiddle
What i need is a counter or something alike that will let me know how many of the red blocks are being dropped onto the bottom gray blocks.
eg. Strongly Agree = 2 (when 2 red are dropped onto it)
Agree = 1 (when 1 red block is dropped onto it) etc.
Thanks!
When you drop a red box, can you get the class of the grey box?
what i’m thinking is that you can add the class of the grey to the class of the red and then simply do a count of all reds with a particular grey in its class.
so class=”red1″ and after drop class=”red1 grey2″.
when you pick up a red that has “grey” in it’s class, then you need to remove the grey class names.
i know i didn’t reference any code but i was just thinking of the concept rather than actual code. I can have a go if you wish though.
so the process i think would be as follows.
setup:
Grey box class has extra class like class=”GreyBox Grey1″ and class=”GreyBox Grey2″
on drop:
$('.Grey1').lengthon pick up off grey