1

I have a table like this I need to get the anchor tag value(class or id) from the table. In other words, how to get the anchor tag value using jQuery

        <table class="kimztableclass" id="kimztableid">
        <tr>
        <a class="kimzanchorclass" id="kimzanchorid" >Kimz Value</a>
        </tr>
        </table>

I need something like this

        $(document).ready(function() {
        $('.mytableanchortagclass').editable({
            .........do my coding stuff.................
            }
        }
        });
        });     

In short - I need to get the anchor tag id/name inorder to proceed with my jQuery stuff.

Thanks, Kimz

user3350885
  • 739
  • 4
  • 16
  • 38

3 Answers3

4

use

For getting class name

$(".kimztableclass a").attr("class");

For getting Id

$(".kimztableclass a").attr("id");

For getting text

$(".kimztableclass a").text();
Anoop Joshi P
  • 25,373
  • 8
  • 32
  • 53
  • that is done anoop.. thanks again. :) you are my time-saver – user3350885 Mar 12 '14 at 12:54
  • anoob - could you please help me with this question which i have asked in SOF - http://stackoverflow.com/questions/22351116/bootstrap-pagination-an-inline-implementation – user3350885 Mar 12 '14 at 13:03
1

use attr() method

$('.mytableanchortagclass tr').find('a').attr('id')
Murali Murugesan
  • 22,423
  • 17
  • 73
  • 120
  • thanks bro, could you please help me with this question which i have asked in SOF - http://stackoverflow.com/questions/22351116/bootstrap-pagination-an-inline-implementation – user3350885 Mar 12 '14 at 13:07
0

This will return all anchor tag with class kimzanchorclass:

$('a.kimzanchorclass').attr('id');
Supriya Pansare
  • 519
  • 1
  • 4
  • 11