title: Highlight substring in element
body: <p>What is the best way to highlight a specific substring in a div element in an event? 
  By highlight, I mean apply some CSS style, like yellow background or something.</p>
  
  <p>Basically I need a simple JS client side function of the form:</p>
  
  <pre><code>function (element, start, end) { 
    // element is the element to manipulate.  a div or span will do
    // start and end are the start and end positions within the text of that
    // element where highlighting should be.
    // do the stuff
  }
  </code></pre>
  
  <p>Only one highlight will be active.</p>