title: jQuery - selector inside another selector - passed in variable loses its value and becomes an indexer?
body: <p>I'm somewhat new to jQuery and am just wondering how I go about passing in a string value rather than what appears to be a reference to a jQuery item from a selector?  I'm having a hard time explaining so here's a sample demo.  Don't even know what to title this so please have at editing the title if you can think of a better one.</p>
  
  <p>At the line where I do <code>$("td").filter(function(str){</code>  the str that is passed in becomes an index position of which TD I'm in. So while debugging the first time in it's a 0 the next time a 1 and so on.  I tried google but I'm not even sure what to search for, any documentation/code help would be much appreciated</p>
  
  <pre><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript"&gt;
  $(document).ready(function(){
      $("select[name='showTeam']").change(function () {
              $("select[name='showTeam'] option:selected").each(function () {
                  var str = $(this).val().toLowerCase();
                  //str = what it was set to up there
                  //alert(str);
                  $("td").filter(function(str) {
                      //str = becomes a number = to position of TD.. ie for 5th TD match STR = 4 (starts at index 0)
                      return $(this).text().toLowerCase().indexOf(str) != -1;
              }).css('background','red');
          });
      })
  });
  &lt;/script&gt;
  Show Team: &lt;select id="showTeam" name="showTeam"&gt;
      &lt;option&gt;All&lt;/option&gt;
      &lt;option&gt;Chelsea&lt;/option&gt;
      &lt;/select&gt;
  
  &lt;div id="games"&gt;
    &lt;table border="1"&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
      &lt;th&gt;ID&lt;/th&gt;
      &lt;th&gt;Game date&lt;/th&gt;
      &lt;th&gt;Field&lt;/th&gt;
      &lt;th&gt;Home team&lt;/th&gt;
      &lt;th&gt;Home team score&lt;/th&gt;
      &lt;th&gt;Away team&lt;/th&gt;
      &lt;th&gt;Away team score&lt;/th&gt;
      &lt;th&gt;Game type&lt;/th&gt;
    &lt;/tr&gt;
    &lt;tr class="odd_line" id="game_460"&gt;
      &lt;td&gt;459&lt;/td&gt;
      &lt;td&gt;03 Nov 19:00&lt;/td&gt;
      &lt;td&gt;Field 2&lt;/td&gt;
      &lt;td&gt;Madrid &lt;/td&gt;
      &lt;td&gt;3&lt;/td&gt;
      &lt;td&gt;Bayern Munich &lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;Season&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr class="odd_line" id="game_461"&gt;
      &lt;td&gt;460&lt;/td&gt;
      &lt;td&gt;03 Nov 19:00&lt;/td&gt;
      &lt;td&gt;Field 3&lt;/td&gt;
      &lt;td&gt;chelsea&lt;/td&gt;
      &lt;td&gt;5&lt;/td&gt;
      &lt;td&gt;arsenal&lt;/td&gt;
      &lt;td&gt;4&lt;/td&gt;
      &lt;td&gt;Season&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/div&gt;
  </code></pre>