title: want to get start and end index of text(content)
body: <p>I want to get the start and end index of the selected text(content) from the whole content using selectNodeContents() or document.createRange().</p>
  <p>I have tried</p>
  <pre><code>&lt;div id=&quot;parent&quot;&gt;
   Hello everyone! &lt;p id=&quot;demo_text&quot;&gt;This is my home page&lt;/p&gt;
  &lt;/div&gt;
  
  var node = document.getElementById('demo_text');
  var range = document.createRange();    
  range.selectNodeContents(node);
  </code></pre>
  <p>I want,</p>
  <pre><code>startIndex = 16 // starting index of &quot;This&quot; from &quot;Hello everyone! This is my home page&quot;
  endIndex = 35 // end index of &quot;page&quot; from &quot;Hello everyone! This is my home page&quot;
  </code></pre>