getting attributes from clicked anchor...

getting attributes from clicked anchor...

Hi, I'm new to jquery and going through my learning curve now. If I have my html (being generated by a PHP MySQL call) set up as such:

  1. <a href="javascript:void(0);" class="clickable" opendesc="<?php print $thisid; ?>"><?php print $appname; ?></a>

so where opendesc will equal 1, 2, 3, 4...

how can I pass this to jquery?

I tried this:

  1. $(document).ready(function(){
  2.                 $("a.clickable").click(
  3.                     function(){
  4.                         alert($('a.clickable').attr('opendesc'));
  5.                 });
  6.             });
but kept getting 1 or 2, depending on if the anchor was even or odd in the PHP loop cycle...

Thanks