How can i position a dropdown at cursor position inside a textarea?

前端 未结 2 861
予麋鹿
予麋鹿 2021-02-06 10:50

How can i position my dropdown at cursor position inside a textarea? I have found this question was already asked here many times but i cant able figure out the correct solution

2条回答
  •  说谎
    说谎 (楼主)
    2021-02-06 11:25

    You can get the position of the mouse and then move the drop-down list to this position. You just need to ensure the popup content has a higher z-index than the element you'd like it occlude, and that it's position is set to absolute.

    Here's a small test sample I wrote once.

    
    
    
    
    
    
    
        

提交回复
热议问题