Get the Highlighted/Selected text

后端 未结 5 1563
無奈伤痛
無奈伤痛 2020-11-21 06:34

Is it possible to get the highlighted text in a paragraph of a website e.g. by using jQuery?

5条回答
  •  野性不改
    2020-11-21 07:20

    Use window.getSelection().toString().

    You can read more on developer.mozilla.org

提交回复
热议问题