title: Match where text equals a passed value Jquery
body: <p>I am trying to put a little script together that takes the value i have passed through and matches it aqgainst those that are on my page.. For example I am looking for all the instances of the word "Specsavers" on my page.  </p>
  
  <p>So in this example varName would be specsavers and each td.col-2 would contain a business name, maybe 3 of them are specsavers,  i need match these and do a count on how many instances of 'specsavers' there are</p>
  
  <pre><code>Selenium.prototype.doStoreTextOccurrence = function (locator, varName) {
      // Find where element is located (so parent div for example)
      var locator = this.page().findElement(locator);
  
      jQuery(locator).find('td.col-2').each(function (index, elem) {
          // though about using this below but cant work out how to 
          // pass through variables
          company = jQuery(elem).text(); 
          results = $("div:contains(varName)");
      });
  }
  </code></pre>
  
  <p>Im a bit stuck at this point</p>
  
  <p>thanks</p>