JavaScript How to get selected text if Ctrl + Enter is pressed?

preview_player
Показать описание
There is some site.
There is a text on that site.
To get selected text we need the document object and the getSelection method.
The getSelection method returns a Selection object.
We need toString method of the Selection object to get the selected text.
To check the Ctrl + Enter combination is pressed we need to add an event listener
and to test key and ctrlKey properties of the event object.
That’s all.
Let’s open the site, select a text part and press ctrl enter.
We have got the selected text.
Рекомендации по теме
Комментарии
Автор

Ask your questions in the comments and we will try to answer your questions in our videos

Samovar
visit shbcf.ru