Skip to main content

How to find the wrapper tag by char position in html

I'm trying to get the html tag object that wraps the char in specific position. for example:

position = 34
(first 'e' in the word "everyone")
<html><body><h1>Welcome</h1><p>Hi everyone</p><body></html>

Is there a way to get the 'p' tag that wraps this position?
I need the tag object itself, for changing its innerHTML.

Via Active questions tagged javascript - Stack Overflow https://ift.tt/WmyFxjk

Comments