newBee
newBee

Reputation: 13

Get table id dynamically in gwtquery/jquery

I'm having some difficulty in getting the id of a table dynamically in gwtquery.

I've 3 tabbed table each with different table id and I need the id of the table to proceed.

I tried

 $(tableData).closest("table").attr("id"));
 $(tableData).parents("table").attr("id"));

Both of them doesnt work.

This is how my table looks

 <div style="" class="viewArea">
 <div aria-hidden="false" style="" class="overflow">
  <table id="tableId1" class="tableClass">

I would like to get the table id dynamically, for table 2 its tableId2 and so on.

Upvotes: 0

Views: 86

Answers (1)

abhi
abhi

Reputation: 1084

use this function to fetch table values

$(function () {
                      var abc = $('table');          
           alert($(abc[0]).attr('id'));
        });

above is just a demo, you can use foreach loop to fetch all the values

Upvotes: 0

Related Questions