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:
- <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:
- $(document).ready(function(){
- $("a.clickable").click(
- function(){
- alert($('a.clickable').attr('opendesc'));
- });
- });
but kept getting 1 or 2, depending on if the anchor was even or odd in the PHP loop cycle...
Thanks