I have a div which has the contenteditable property set to true. I want to be able to get the range of a string in the div. The range should contain the starting offset(relative to the text content of the div) of that particular word and if possible the length of the word.
For example, if the string in the div contains "This is a test" , I want to be able to get the range of the string "test" dynamically ( I would not know how many characters are there). For now, the div would only contain text.
It would be great if someone could help me out with this.