Select Text & highlight selection or get selection value (React)

后端 未结 6 1317
长发绾君心
长发绾君心 2021-02-02 02:33

I have a React application which displays some spans:

Hello my name  is &l         


        
6条回答
  •  我在风中等你
    2021-02-02 02:57

    There is no React-specific solution for this. Just use window.getSelection API.


    To output highlighted text run window.getSelection().toString()

提交回复
热议问题