title: jQuery: do something if select element exists
body: <p>Hey, I looked around on Stack Overflow and tried a few other people's attempts at this, and I just couldn't get this to work.</p>
  
  <p>I have a select element like this:</p>
  
  <pre><code>&lt;select id="slct_firstCat" name="slct_firstCat" size="15"&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>This only shows once a specfic AJAX request has completed, so this select element is NOT loaded with the original page's DOM, it is loaded as a seperate AJAX request after the main page has loaded.</p>
  
  <p>I basically want to do this...</p>
  
  <pre><code>if (/* select element exists */) {
    // Then change the colour of a div to green
  } else {
    // Change the colour to red
  }
  </code></pre>
  
  <p>But remember, this has to work <strong>after</strong> the page has loaded. I can click the select to run the JS function if needed.</p>
  
  <p>I tried this code below, but couldn't get it to work:</p>
  
  <pre><code>if ($(".element1").length &gt; 0 || $(".element2").length &gt; 0 {
    // code
  }
  </code></pre>
  
  <p>So basically, if the select element exists, then change the tab colour to green, else change it to red.</p>