all articles

firefox does not allow drag&drop; if not data is attached

2016-09-16 @sunderls

firefox drag&drop; js

desc

Firefox doesn't allow drag&drop; if no data is attached. Other browsers are ok for this.

workaround

manually set some data to it like 'text';

$xxx.on('dragstart', function(e){
    $item = $(this);

    e.originalEvent.dataTransfer.effectAllowed = 'move';

    //set some data to it to enable drag&drop; in firefox 
    e.originalEvent.dataTransfer.setData('text', "" + someData);
});