开发者

Add a dropdown menu when clicking on text in the DOM

开发者 https://www.devze.com 2022-12-10 04:45 出处:网络
Is there a way I can pop up a dropdown menu on开发者_如何学运维 a webpage when I click certain text? I have text that is highlighted using the span tag. I added an eventlistener - click. When I click,

Is there a way I can pop up a dropdown menu on开发者_如何学运维 a webpage when I click certain text? I have text that is highlighted using the span tag. I added an eventlistener - click. When I click, I want to pop up a dropdown menu on the text. I have tried appending a div to the span and then adding the items as a list. But it does not show up on the DOM, and it does not even give me any error messages.

Is this even possible? Can someone help me with this please?


there is way to do it in javascript .for example popup for img tag

<img height="119" width="180" style="cursor: pointer;" oncontextmenu="return dm_popup(2, 2000, event);" onclick="return dm_popup(1, 2000, event);" src="data-samples/images/popup_pic.gif"/>

here the sample for your reference

Note:its not default feature in javascript.

Popups can be created without javascript using css only

0

精彩评论

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