blue-sky
blue-sky

Reputation: 53806

Check the type of draggable

The draggable element below can be an <li> element. Can I check if the element dragged is an <li> using .attr or some other method?

$(".myCss" ).droppable({
    drop: function( event, ui ) {
        ui.draggable.attr('class'));
    } 
});

Upvotes: 1

Views: 44

Answers (1)

VisioN
VisioN

Reputation: 145398

You can use is method:

$(".myCss" ).droppable({
    drop: function( event, ui ) {
        if (ui.draggable.is("li")) {
            // ...
        }
    } 
});

DEMO: http://jsfiddle.net/ZsT2Y/

Upvotes: 3

Related Questions