title: else statement doesn't seem to execute
body: <p>i'm a complete begginner and was hoping to get some help on my first script.</p>
  
  <p>basically i want one link that when clicked makes a div slide down and changes the links text, when its clicked again the process reverses.</p>
  
  <p>here is my code:</p>
  
  <pre><code>$(function() {
  if ($('#link1:contains("link text")')) {
          $('#link1').click(function() {
              $('#div1').slideDown(2000);
              $('#link1').text('hide div 1');
          }); 
  }
  else {
          $('#link1').click(function() {
              $('#div1').slideUp(2000);
              $('#link1').text('link text');
          }); 
  }
  });
  </code></pre>
  
  <p>Any help would be appreciated, thanks guys.</p>