javascript - Fetching the column id in a table using jQuery -


i have table structure.

<table id = "table1">    <thead>       <tr id = "header_row">          <th> <a id = "a1">abc</a> </th>          <th> <a id = "a2">def</a> </th>          <th> <a id = "a3">ghi</a> </th>          <th> <a id = "a4">jkl</a> </th>       </tr>    </thead>    <tr>.....data filling table.....</tr>    <tr>.............</tr>    .    . </table> 

so table, want fetch value "a2", can please tell me how this? thanks!

edit: there many other <a> <table> tags on page, if there way extract using id?

so table, want fetch value "a2"

you mean fetch id of second column in header row?

try this

$("#header_row th a:eq(1)").attr("id") 

if wants fetch abc of know a based on id then

$("#a2").html(); //or text() 

Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -