Click Function Issue

Click Function Issue

Hi,

first off I would like to say that I posted this message over 24 hours ago and it said that I would have to await moderation but as yet nothing, so here goes again.

I have a download counter on my site that I am fiddling around with, see here:-

www.madtogger.co.uk/page/software

The counter is printed to the screen using the code below:-

  1. <center>
  2. <table>
  3. <tr>
  4. <td>File Name</td>
  5. <td>Downloads</td>
  6. </tr>
  7.  <?php 

  8.         foreach($files_array as $key=>$val)
  9.         {
  10.             echo '
  11. <tr>
  12. <td><a href="http://www.madtogger.co.uk/dlc_download.php?file='.urlencode($val).'">'.substr($val, 0, strpos($val, '.')).'</a></td> 
  13. <td><span class="download-count">'.(int)$file_downloads[$val].'</span></td>
  14. </tr>';
  15.         }
  16.     
  17.     ?>

  18. </table>
  19. </center>

The counter is activated using the jQuery code below:-

  1. $(document).ready(function(){
  2. /* This code is executed after the DOM has been completely loaded */

  3. $('tr').click(function(){
  4. var countSpan = $('.download-count',this);
  5. countSpan.text( parseInt(countSpan.text())+1);
  6. });
  7. });

As you can see, the click function activates when the user clicks on the filename that they want to download as it is contained within the <TR> tag and this then updates the counter display.

That all works fine but the glitch I am trying to solve is that if a user just clicks on cell2 of the table row the counter also increases even though a download has not been started.

What I am trying to achieve is that a user can only click the filename to cause the counter to increase and that no action is taken when a click is made anywhere else on the row.

Any help would be appreciated.

Regards..,

K