title: Compare string with HTML text
body: <p>I have a string of text that I want to compare with another string that has HTML code. The problem is that the text I need to compare it to in the HTML code is within different tags. Also, if the string exists in the HTML code then I want to wrap it inside a <code>&lt;mark&gt;</code> tag.</p>
  
  <p>This is the example I am using:</p>
  
  <pre><code>var html = "&lt;h1&gt;This is a heading&lt;/h1&gt;&lt;div class="subtitle"&gt;and this is the subheading&lt;/div&gt;&lt;p class="small"&gt;this is some example text&lt;/p&gt;";
  var lookup = "is a heading and this is the subheading this is some";
  var finalHtml = ""; //will contain new html
  
  //Need to do some comparison and then add a &lt;mark&gt; tag around found string.
  
  console.log(finalHtml);
  //This should print "&lt;h1&gt;This &lt;mark&gt;is a heading&lt;/h1&gt;&lt;div class="subtitle"&gt;and this is the subheading&lt;/div&gt;&lt;p class="small"&gt;this is some&lt;/mark&gt; example text&lt;/p&gt;"
  </code></pre>
  
  <p>I am using Javascript/Jquery to do this.</p>