jqueryjquery-uidraggabledroppablejquery-data

How to check if an element is droppable, draggable or other 'ble'?


I've got a bunch of elements with jQuery. Some are draggable, some are droppable and some are both. How can I detect if an element is draggable or droppable?


Solution

  • You could also use jQuery data() like this..

    if ($(elem).data('draggable')) {
            alert("yes");
    }
    else {
            alert("no");
    }
    
    if ($(elem).data('fooable')) {
            alert("yes");
    }
    else {
            alert("no");
    } 
    

    See it here: http://bootply.com/60153