title: onclick even not working
body: <p>in the code below on clicking the button corresponding price should be displayed and the click here text shud hide but it doesn't work nothing happens</p>
  
  <pre><code>&lt;body&gt;
  &lt;?php $itemprice  = array("$10","$3","$5","$7");?&gt;
  &lt;?php $len = count($itemprice);
  $i=0; 
  ?&gt;
  
  &lt;div class= "gallery"&gt;
  &lt;?php while ($i&lt;$len):?&gt;
  &lt;div class="index"&gt;
  &lt;div class="clickbtn"&gt;
      &lt;a id="hiddenprice-&lt;?php echo $i; ?&gt;" href="http://www.bookurl.com" onclick="show_price(&lt;?php echo $i; ?&gt;)" target="_blank"&gt;
     Click Here to reveal price &lt;?php  echo $itemprice[$i]; ?&gt;
      &lt;/a&gt;
  &lt;a id="revealedprice-&lt;?php echo $i; ?&gt;" style="display:none;" href="http://www.bookurl.com"&gt;&lt;?php  echo $itemprice[$i]; ?&gt;&lt;/a&gt;
  &lt;/div&gt;
  
  &lt;/div&gt; 
  &lt;?php $i++;endwhile;
  ?&gt;
  &lt;script&gt;
     function show_price(&lt;?php echo $i; ?&gt;) {
         document.getElementById('revealedprice-&lt;?php echo $i; ?&gt;').style.display = '';
         document.getElementById('hiddenprice-&lt;?php echo $i; ?&gt;').style.display = 'none';
     }
  &lt;/script&gt;
  &lt;/div&gt;
  
  
  &lt;/body&gt;
  </code></pre>
  
  <p>u can see the outcome live at <a href="http://myproject.byethost7.com/test1.php" rel="nofollow">http://myproject.byethost7.com/test1.php</a> </p>