title: Using slideUp() and slideDown() functions based on conditions
body: <p>I used a code to toggle a panel in my html page whenever I click a particular element on my html page( which is a blank hyperlink in my case within  tag ):</p>
  
  <pre><code>    &lt;script&gt; 
       $(document).ready(function(){
        $("#technology").click(function(e){
          $("#technology_panel").slideToggle("slow");
          e.preventDefault()
          });
       });
      &lt;/script&gt;
  </code></pre>
  
  <p>This is working fine as long as I simply want to toggle the panel up/down. But what I actually want 
  is when I click on the particular element, the panel comes down, but when I click anywhere else on the html page the panel should go up.I tried this code but this doesn't work as expected:</p>
  
  <pre><code>    if (document.getElementById(planning).click()== true)
      { 
       $(document).ready(function(){
         $("#planning").click(function(e){
           $("#planning_panel").slideDown("slow");
           e.preventDefault()
        });
      });
      }
       else
       {
           $(document).ready(function(){
                 $("#planning").click(function(e){
                  $("#planning_panel").slideUp("slow");
               e.preventDefault()
               });
             });
       }
  </code></pre>