Question

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

Was it helpful?

Solution

use

For getting class name

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

For getting Id

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

For getting text

$(".kimztableclass a").text();

OTHER TIPS

use attr() method

$('.mytableanchortagclass tr').find('a').attr('id')

This will return all anchor tag with class kimzanchorclass:

$('a.kimzanchorclass').attr('id');
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top