0

How can I select the ::selection element using JavaScript in order to apply style rules?

document.querySelector("::selection").style.backgroundColor = "red";

Uncaught TypeError: Cannot read property 'style' of null(…)
Peter Gordon
  • 1,075
  • 1
  • 18
  • 38

0 Answers0