Is it possible to restrict the range of select all/Ctrl+A?
问题 I am working on a website where I would like to be able to display a box containing syntax-highlighted source code for the user to copy. When I click on the box, giving it focus (Chrome shows its focus outline), and type Ctrl+A , the text of the entire page is selected, whereas I would like only the syntax-highlighted source code within the box to be selected. Is it possible to restrict the range of select all/ Ctrl+A to only the text within the box, preferably without using an <iframe>? My