jQuery .each inside function
<p>I dont know why .each() not working here in my code</p>

<pre><code>function showhide(id){
    $('#mydiv'+id).each(function(){
    if(this).is(":visible") ) {
      $(this).css('display','none'); 
    }else {     
      $(this).css('display','block');       
        }
    });
}

&lt;span id="mydiv" style="display:none;"&gt;
blah blah blah
&lt;/span&gt;

&lt;a href="#" onclick="showhide($id);return false;" /&gt;show/hide&lt;/a&gt;
</code></pre>
