Hiding Rows Via Drop Down Lists
<p>I have this weird issue with hiding/showing rows of a table via jQuery and drop down lists.  Instead of posting back data based on the filters I just want to hide the data not relevant to what's selected in the drop down lists.  Here's the snippet:</p>

<pre><code>$().ready(function() {
  $("#SupplierID").change(changeme);
  $("#BusinessID").change(changeme);
});

function changeme() {
  $("table tr").show();
  $("table tr td:nth-child(2):not(:contains('" + $("#SupplierID :selected").text() + "'))").parent().hide();
  $("table tr td:nth-child(6):not(:contains('" + $("#BusinessID :selected").text() + "'))").parent().hide();
  return false;
}
</code></pre>

<p>The problem with it is that SupplierID works fine, but BusinessID only works once a SupplierID has been selected, and not before.  If I go into the page and select a BusinessID from the drop down list straight away nothing happens.  I <em>have</em> to change the SupplierID drop down list first in order for it to work.  Additionally if SupplierID is set to the "All" option (blank value) then the BusinessID drop down list doesn't work.</p>

<p>Any ideas?</p>

<p><strong>EDIT</strong></p>

<p>Indeed it was an error because of a no-value thing.  The thing is, this is what I have to have now:</p>

<pre><code>$(function() {
  $("#SupplierID, #BusinessID").change(changeme);
});

function changeme() {
  $("table tr").show();
  if ($("#SupplierID :selected").val()) {
    $("table tr td:nth-child(2):not(:contains('" + $("#SupplierID :selected").text() + "'))").parent().hide();
  }

  if ($("#BusinessID :selected").val()) {
    $("table tr td:nth-child(6):not(:contains('" + $("#BusinessID :selected").text() + "'))").parent().hide();
  }
}
</code></pre>

<p>It just seems a bit nasty.  Any recommendations on how to make this more elegant?</p>
