<div className="kat-project-user-timeline-drag-indicator-wrapper-bottom"
onDrag={(event) => {this.dragTask(event)}}>
</div>
dragTask(event) {
console.log("logic goes here")
}
The function is not getting called for the first time. But from second time it is working fine. I tried using, event.preventDefault(), but still it is not working.
To add the click event in React using plain JavaScript, you need to use addEventListener() to assign the click event to an element. Create one <button> element as ref props so that it can be accessed to trigger the click event.
Definition and UsageThe ondragend event occurs when the user has finished dragging an element or text selection. Drag and drop is a very common feature in HTML5. It is when you "grab" an object and drag it to a different location. For more information, see our HTML Tutorial on HTML5 Drag and Drop.
Try adding draggable="true"
and see if that works:
<div draggable="true" className="kat-project-user-timeline-drag-indicator-wrapper-bottom"
onDrag={(event) => {this.dragTask(event)}}>
</div>
dragTask(event) {
console.log("logic goes here")
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With