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
Post a Comment