开发者

How to get a href of drag and drop

开发者 https://www.devze.com 2023-02-24 11:09 出处:网络
checking this sample. http开发者_运维百科://html5demos.com/drag i was wonder how to get when You drop a < li >. (by href)If I understand you correctly: You want to get the href attribute of the el

checking this sample. http开发者_运维百科://html5demos.com/drag

i was wonder how to get when You drop a < li >. (by href)


If I understand you correctly: You want to get the href attribute of the element being dropped? If so you can view source on that page and look on line 131.

var el = document.getElementById(e.dataTransfer.getData('Text'));

the el element has an href attribute so you can do: el.href and that will give you the href you are asking for and in this case it will return html5demos.com/drag#

0

精彩评论

暂无评论...
验证码 换一张
取 消