title: showing or hiding div with id generated using php and javascript
body: <p>I am trying to hide or show the div based on the div id from the php function. I am not able to make it work, please help me.</p>
  
  <p>Javascript:</p>
  
  <pre><code>&lt;script&gt;
  showOrHide(id) {
      var elem=getElementById(id);
      if(elem.style.visibility="hidden")
          elem.style.visibility="visible";
      else
          elem.style.visibility="hidden";
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>PHP Script:</p>
  
  <pre><code>&lt;?php
  function display_link($link_id,$upvote_array,$downvote_array,$divid) {
  ?&gt;
      &lt;a href="javascript:showOrHide(&lt;?php echo $divid; ?&gt;)"&gt;More links&lt;/a&gt;
      &lt;div id="&lt;?php echo $divid ?&gt;" style="visibility:hidden;"&gt;
      &lt;/div&gt;
  &lt;?php } ?&gt;
  </code></pre>