title: hide/show of div class
body: <p>I wrote a code to show a div element(shareform) when a link is clicked and to hide it when the link is clicked again. I have many Forms under which this link 'Share' will be displayed. If i have only one Form, this code works fine. That is, initially the 'shareform' element is hidden and when I click the link, it is shown and when I click the link again the 'shareform' is hidden.</p>
  
  <p>If I have 2 forms, the 'shareform' element for the second Form is not hidden initially. Isn't this $('#shareform').hide(); suppose to hide the form for all the Share links?</p>
  
  <p>And also, when I click the second "share" link, the 'shareform'  is shown and hidden for the first "share" link. What Am I doing wrong? Can someone help me?</p>
  
  <pre><code>    var flag=0;
      $('#shareform').hide();
      $(".Share").click(function(){
          if(flag==1){
              $('#shareform').hide('fast');
              flag=0;
          }
          else{
              $('#shareform').show('slow');
          flag=1;
              return false;
          }
  
       });//.Share click
  
      $("#shareform .button").click(function(){
          $("#userList option:selected").each(function(){
              selected_value[i]=$(this).val();
              alert(selected_value[i]);
              i++;
          });
      });
  
     &lt;li id="Share&lt;?php echo $r['Form']['id']?&gt;"&gt;
     &lt;a href="#" class="Share"&gt;Share&lt;/a&gt;
     &lt;form action="/cake_1_2/forms/share/&lt;?=$formid?&gt;/&lt;?=$userid?&gt;" method="post" name="shareform" id="shareform"&gt;
  
     &lt;p&gt;Select the users with whom you want to share the Form&lt;/p&gt;
     &lt;select id="userList" name="userList" multiple&gt;
     &lt;?php foreach($users as $user){  ?&gt;
        &lt;option value="&lt;?=$user['User']['name']?&gt;"&gt;&lt;?=$user['User']['name'];?&gt;&lt;/option&gt;
  
     &lt;?php }?&gt;
          &lt;/select&gt; 
          &lt;input type="submit" class="button" value="Share"/&gt;
      &lt;/form&gt; 
  &lt;/li&gt;
  </code></pre>
  
  <p><strong>EDIT:</strong>
  I'm sorry, actually i want to hide only the id element share_form,not the class 'Share' coz that class refers to the link alone. also i changed share_form to shareform,it still doesnt work.</p>
  
  <p>EDIT 2:</p>
  
  <p>Ok, I've changed id to class,i.e class='shareform'. Now the shareform class is hidden initially. But if I click the 'Share' link, the 'shareform' class is showed for both the forms.</p>