OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Determine which DOM elements the current text selection contains

  • Thread starter Thread starter sonofdelphi
  • Start date Start date
S

sonofdelphi

Guest
I want to be able to find out which DOM elements are present in the text currently selected by the user in the browser.

document.getSelection() would get us the currently selected text. But how can we determine which DOM elements are contained in this text selection?

<p>I want to be able to find out which DOM elements are present in the text currently selected by the user in the browser. </p>

<p>document.getSelection() would get us the currently selected text. But how can we determine which DOM elements are contained in this text selection?</p>
 

Latest posts

Online statistics

Members online
0
Guests online
4
Total visitors
4
Top