How to get the label value from table row when row number is known, using Javascript

Nikunj Kumar

I have a table like this-

<table>
 <tr>
   <td>
      <label id="lbl1" value="1">Label1</label>
   <td> 
   <td>
     Some data
   </td>
   <td>
     Some data
   </td>
 </tr>
 <tr>
   <td>
      <label id="lbl2" value="1">Label1</label>
   <td> 
   <td>
     Some data
   </td>
   <td>
     Some data
   </td>
 </tr>
 <tr>
   <td>
      <label id="lbl3" value="1">Label1</label>
   <td> 
   <td>
     Some data
   </td>
   <td>
     Some data
   </td>
 </tr>
</table>

My problem is that I want to alert the value of label present in the second row's first column. Assume that I don't know label id means I know its pattern like lbl1,lbl2 or lbl3.. but not exactly what it is in the second row.

nehem

If you are okay to use jQuery use this fiddle

var label = $('table tr:eq(1) td:eq(0)').find("label").attr("value")
alert(label);

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to get value of table cell with jquery from checkbox using absolute row number

From Dev

how to get the id value in each row from the append table in JavaScript

From Dev

How to get elements from table by row number in sql server

From Dev

How to easily get row number when using LIMIT in MySQL?

From Dev

How to get attribute value from table row on click

From Dev

How to get the value of a cell from an html table after deleting the row?

From Dev

How to get controls from prototyped UITableViewCell when table row is selected?

From Dev

Get row number when using "MAXIFS" function

From Dev

How to get clicked row number in table in Vaadin?

From Dev

get value of a specific row of a table using jquery

From Dev

How to get row data from table using angularjs

From Dev

How to get row data from table using angularjs

From Dev

How to Get Value from GridView (row click) in javascript

From Dev

Get data from table row to Javascript

From Dev

How to get/access row value from Repeater using jquery?

From Dev

How to get/access row value from Repeater using jquery?

From Dev

How to get other columns from a row when using an aggregate function?

From Dev

Get row info from table using razor

From Dev

In GridView, when click on checkbox add values from label to TextBox using JavaScript in the same row of Grid

From Dev

How do I insert a "remove button" to every table row when inserting a new row using javascript/jQuery

From Dev

How do I insert a "remove button" to every table row when inserting a new row using javascript/jQuery

From Dev

How to get first value of row in table on click?

From Dev

how to get the value of href in table row?

From Dev

How to get row of the table with maximum value

From Dev

To delete a row dynamically from a table using javascript

From Dev

How to insert value into a html table row by row from a popup modal using jQuery

From Dev

How to insert value into a html table row by row from a popup modal using jQuery

From Dev

How to get value of another row if row does not exist in table?

From Dev

How to get table row details when redirecting

Related Related

  1. 1

    How to get value of table cell with jquery from checkbox using absolute row number

  2. 2

    how to get the id value in each row from the append table in JavaScript

  3. 3

    How to get elements from table by row number in sql server

  4. 4

    How to easily get row number when using LIMIT in MySQL?

  5. 5

    How to get attribute value from table row on click

  6. 6

    How to get the value of a cell from an html table after deleting the row?

  7. 7

    How to get controls from prototyped UITableViewCell when table row is selected?

  8. 8

    Get row number when using "MAXIFS" function

  9. 9

    How to get clicked row number in table in Vaadin?

  10. 10

    get value of a specific row of a table using jquery

  11. 11

    How to get row data from table using angularjs

  12. 12

    How to get row data from table using angularjs

  13. 13

    How to Get Value from GridView (row click) in javascript

  14. 14

    Get data from table row to Javascript

  15. 15

    How to get/access row value from Repeater using jquery?

  16. 16

    How to get/access row value from Repeater using jquery?

  17. 17

    How to get other columns from a row when using an aggregate function?

  18. 18

    Get row info from table using razor

  19. 19

    In GridView, when click on checkbox add values from label to TextBox using JavaScript in the same row of Grid

  20. 20

    How do I insert a "remove button" to every table row when inserting a new row using javascript/jQuery

  21. 21

    How do I insert a "remove button" to every table row when inserting a new row using javascript/jQuery

  22. 22

    How to get first value of row in table on click?

  23. 23

    how to get the value of href in table row?

  24. 24

    How to get row of the table with maximum value

  25. 25

    To delete a row dynamically from a table using javascript

  26. 26

    How to insert value into a html table row by row from a popup modal using jQuery

  27. 27

    How to insert value into a html table row by row from a popup modal using jQuery

  28. 28

    How to get value of another row if row does not exist in table?

  29. 29

    How to get table row details when redirecting

HotTag

Archive