Why am I not able to drag the span but instead the img?

前端 未结 1 920
醉酒成梦
醉酒成梦 2020-12-22 08:59

I am trying to create a textarea where I can add HTML elements which should be draggable on character level. This question is related to another I am currently asking but th

相关标签:
1条回答
  • 2020-12-22 09:34

    I googled around a bit to see how HTML5 dragging works, and I found that in order to get a DOM element to be draggable, you have to add the new 'draggable' attribute to it, and set it to true. The confusing part about your problem is that images and links are draggable by default!

    I wasn't really able to test this well because your script throws an error saying your function smartdrag does not exist.

    Though I'm pretty hopeful about this possible solution as it covers your problem entirely, and comes from a trustworthy documentation.

    0 讨论(0)
提交回复
热议问题