Retrieving the column from the HTML table
source link: https://www.codesd.com/item/retrieving-the-column-from-the-html-table.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Retrieving the column from the HTML table
How to get values from one column of HTML table using JavaScript?
I want to get values of one field i.e one column from the HTML table which is dynamically created.
When you are creating the table dynamically you must be assigning some id to table, so try this:
var allTDs = document.getElementById('<TableId>').getElementsByTagName('TD');
var valueNeeded = allTDs[0].innerHTML;
If you want to get the values of all the first columns in all the rows the use this:
var allTRs = document.getElementById('<TableId>').getElementsByTagName('TR');
for(var i = 0; i < allTRs .length; i++)
{
//This is a loop so store the value of each TD or column wherever you want to
var valueNeeded = allTDs.getElementsByTagName('TD')[0].innerHTML;
}
Related Articles
Removing the last column from an HTML table - using preg_replace
ASP.NET Retrieves the html table
Retrieving the html table field by given values
Attempt to hide a column from an html table using jQuery
How to extract only the second cell from the second column of an html table using php
Importing and mapping data from the source file to the HTML tables
The width of the html table column, the width of the fix when the page was created
how to display the data from the mysql table in the html table in jsp
Select the text in a column of an html table
highlight the selected row and column when you move the mouse in the html table
A: Problem when using XML to get a data frame from the html table
Using CSS and Bootstrap 3 to highlight the currently suspended row and the column of an html table
Get data from the html table with BeautifulSoup
PHP getting data from the HTML table to update the MySQL database
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK