+ 1

Event.dataTransfer.setData('text', event.target.id)

here I know that event.target.id gets u to id of the element which fires the event but why does we need the 'id' of element if we have to set innerHTML of the element as data to transfer it to some other element...what actually event.target.id does?

19th Jul 2017, 6:48 AM
Pradeep Kumar
Pradeep Kumar - avatar
4 Answers
+ 1
event.target.id points on the target point to transfer the data and we need it so we could execute the event on the right element
21st Jul 2017, 8:39 AM
Toper664
Toper664 - avatar
+ 1
if i'm not mistaken :)
21st Jul 2017, 8:39 AM
Toper664
Toper664 - avatar
+ 1
@toper664 bros ...after intense searching on web i got my answer ..thx ... but event.target indicates the element which fires the specific event like ondragstart, ondrop etc .. n here id is used to transfer it to the element with ondrop event .....
21st Jul 2017, 9:08 AM
Pradeep Kumar
Pradeep Kumar - avatar
+ 1
hmmm so that it... thanks @pradeep kumar and sorry for the mistake
21st Jul 2017, 3:07 PM
Toper664
Toper664 - avatar