views:

36

answers:

0

I'm working on a project that involves a fair amount of drag and drop among different category items (e.g. Fabric, Pins, etc). With my current setup, each of these elements is given a unique id code (e.g. F001 for a fabric). I'm trying to get the droppable point to look at the starting letter, and handle it from there.

The roadblock I've hit is with ui.draggable's ability to filter attributes as needed. The article on jQuery's documentation doesn't seem to apply to the ui.draggable object.

I've thrown together some rough code to illustrate what I've done so far. Am I approaching this in the right way? Thanks in advance.

$('#builder').droppable({
    drop:       function(event, ui){

        //If the REL attribute starts with B
        if(ui.draggable.attr('rel^="B"')){

        //Do Something

        }

    }
});