javascript - HTML5 D&D loosing dataTransfer data, please advise -
i made small demo data attached via datatransfer lost. here code example:
var element = document.getelementbyid('draggable'); element.addeventlistener('dragstart', function (evt) { evt.stoppropagation(); evt.datatransfer.effectallowed = 'move'; evt.datatransfer.setdata('test', 'some_dummy_data'); } ); var zone = document.getelementbyid('dropzone'); zone.addeventlistener('dragenter', function (evt) { evt.stoppropagation(); evt.preventdefault(); console.log( '>>>', evt.datatransfer.getdata( 'test' ) ); } );
any appreciated.
"note: security purposes, getdata method can called within ondrop event handler."
reference: apple
Comments
Post a Comment