How to get row index and cellindex together in javascript
JavaScript
<html>
<head>
<title>Read Data from HTML Table uisng JavaScript</title>
<style>
th, td, p, input {
font:14px Verdana;
}
table, th, td
{
border: solid 1px #DDD;
border-collapse: collapse;
padding: 2px 3px;
text-align: center;
}
th {
font-weight:bold;
}
</style>
</head>
<body>
<table id="empTable">
<tr>
<th id="id">ID</th>
<th id="emp">Employee Name</th>
<th id="age">Age</th>
</tr>
<tr><td>01</td><td>Alpha</td><td>37</td></tr>
<tr><td>02</td><td>Bravo</td><td>29</td></tr>
<tr><td>03</td><td>Charlie</td><td>32</td></tr>
</table>
<p><select name="select" id="opt">
<option value="">--Select a Value--</option>
<option value="id">ID</option>
<option value="emp">Employee Name</option>
<option value="age">Age</option></select>
</p>
<input type="button" id="bt" value="Show Data" onclick="showTableData()" />
<p id="info" style="font-style:italic;"></p>
</body>
<script>
function showTableData() {
document.getElementById('info').innerHTML = "";
var myTab = document.getElementById('empTable');
var opt = document.getElementById("opt").value;
var index = document.getElementById(opt).cellIndex;
for (i = 1; i < myTab.rows.length; i++) {
var objCells = myTab.rows.item(i).cells;
for (var j = index; j <= index; j++) {
info.innerHTML = info.innerHTML + ' ' + objCells.item(j).innerHTML;
}
info.innerHTML = info.innerHTML + '<br />';
}
}
</script>
</html>
Also in JavaScript:
- Title
- array length javascript
- Category
- JavaScript
- Title
- how to make a circle in js
- Category
- JavaScript
- Title
- foreach object javascript
- Category
- JavaScript
- Title
- flatten an array in javascript
- Category
- JavaScript
- Title
- filter out arrays js
- Category
- JavaScript
- Title
- filter table search
- Category
- JavaScript
- Title
- ionic modal navbar not showing
- Category
- JavaScript
- Title
- event.persist()
- Category
- JavaScript
- Title
- javascript add to a dictionary
- Category
- JavaScript
- Title
- do more than one thing at start of or loop javascript
- Category
- JavaScript
- Title
- how to add a class to html using javascript
- Category
- JavaScript
- Title
- how to add validator to formgroup
- Category
- JavaScript
- Title
- how do I use const in javascript
- Category
- JavaScript
- Title
- create node project
- Category
- JavaScript
- Title
- If you would prefer to ignore this check, add SKIP_PREFLIGHT_CHECK=true to an .env file in your project. That will permanently disable this message but you might encounter other issues.
- Category
- JavaScript
- Title
- console.log javascript
- Category
- JavaScript
- Title
- Javascript case insensitive string comparison
- Category
- JavaScript
- Title
- how to change list item text color in react
- Category
- JavaScript
- Title
- how to use react memo hooks
- Category
- JavaScript
- Title
- javascript closure stack overflow
- Category
- JavaScript
- Title
- ajax request qml
- Category
- JavaScript
- Title
- faker js
- Category
- JavaScript
- Title
- get attribute value jquery
- Category
- JavaScript
- Title
- Javascript get random item from array
- Category
- JavaScript
- Title
- how to make dynamic columns in jquery
- Category
- JavaScript
- Title
- how to have your discord bot send two message
- Category
- JavaScript
- Title
- discord js bot leave voice channel
- Category
- JavaScript
- Title
- go to another page using javascript
- Category
- JavaScript
- Title
- deploy angular app on google app engine
- Category
- JavaScript
- Title
- how to copy to clipboard in react js
- Category
- JavaScript
- Title
- assign values to a table from javascript in VF page
- Category
- JavaScript
- Title
- get a element using name in jquery
- Category
- JavaScript
- Title
- array to comma separated list js
- Category
- JavaScript
- Title
- change js to json
- Category
- JavaScript
- Title
- async await javascript
- Category
- JavaScript
- Title
- componentWillUnmount functional component for asynchronous requests
- Category
- JavaScript
- Title
- fixed div with scrollable content
- Category
- JavaScript
- Title
- angular material multi select ngmodel
- Category
- JavaScript
- Title
- fetch post js
- Category
- JavaScript
- Title
- body-parser node
- Category
- JavaScript
- Title
- hover vanilla javascript
- Category
- JavaScript
- Title
- window location in react
- Category
- JavaScript
- Title
- "Given a array of numbers representing the stock prices of a company in chronological order, write a function that calculates the maximum profit you could have made from buying and selling that stock once. You must buy before you can sell it"
- Category
- JavaScript
- Title
- how to play sound on load js
- Category
- JavaScript
- Title
- adding cors parameters to extjs ajax
- Category
- JavaScript
- Title
- binary gap
- Category
- JavaScript
- Title
- a simple javascript calculator
- Category
- JavaScript
- Title
- javascript Compare two arrays regardless of order
- Category
- JavaScript
- Title
- Javascript check if undefined
- Category
- JavaScript
- Title
- how to trigger an event on reload js
- Category
- JavaScript
- Title
- how to capitalize a letter based on an index in javascript
- Category
- JavaScript
- Title
- install nodejs from ubuntu 18.04
- Category
- JavaScript
- Title
- angular @Input()
- Category
- JavaScript
- Title
- Add object to array javascript
- Category
- JavaScript
- Title
- find the matching property
- Category
- JavaScript
- Title
- How to get the path to the file that required your module?
- Category
- JavaScript
- Title
- change innertext javascript
- Category
- JavaScript
- Title
- how to use if else inside jsx in react
- Category
- JavaScript
- Title
- createnodefield
- Category
- JavaScript
- Title
- adding element to array javascript
- Category
- JavaScript
- Title
- accept 2 values after decimal in angular forms
- Category
- JavaScript
- Title
- javascript are arrays equal
- Category
- JavaScript
- Title
- conditional jsx property
- Category
- JavaScript
- Title
- javascript character ascii value modify
- Category
- JavaScript
- Title
- detect browser javascript
- Category
- JavaScript
- Title
- How to insert an item into an array at a specific index JavaScript
- Category
- JavaScript
- Title
- how to return an object in javascript
- Category
- JavaScript
- Title
- how to make fizzbuzz in javascript
- Category
- JavaScript
- Title
- como ler um arquivo json com javascript
- Category
- JavaScript
- Title
- how to get element from arraylist react
- Category
- JavaScript
- Title
- event target javascript
- Category
- JavaScript
- Title
- how to add attribute to selected element in javascript
- Category
- JavaScript
- Title
- how to align text inside react component
- Category
- JavaScript
- Title
- app listen with all error handling
- Category
- JavaScript
- Title
- how to get the div value in jquery
- Category
- JavaScript
- Title
- html to jsx
- Category
- JavaScript
- Title
- 1 - - 1 in javascript
- Category
- JavaScript
- Title
- fetch api javascript
- Category
- JavaScript
- Title
- angular two datepickers
- Category
- JavaScript
- Title
- change text of element js
- Category
- JavaScript
- Title
- how to check reactjs version in command prompt
- Category
- JavaScript
- Title
- Factorial Number
- Category
- JavaScript
- Title
- change select value jquery
- Category
- JavaScript
- Title
- .pop js
- Category
- JavaScript
- Title
- change the value in checkbox by button react
- Category
- JavaScript
- Title
- javascript clear div
- Category
- JavaScript
- Title
- dynamic forms in react
- Category
- JavaScript
- Title
- how to check validation for file extension .csv in angular
- Category
- JavaScript
- Title
- interaction js drag anddrop
- Category
- JavaScript
- Title
- how to remove 000webhost watermark 2019
- Category
- JavaScript
- Title
- filter array react
- Category
- JavaScript
- Title
- add element to body javascript
- Category
- JavaScript
- Title
- download image in nodejs
- Category
- JavaScript
- Title
- how to remove item from array javascript
- Category
- JavaScript
- Title
- how to paste in input field react native
- Category
- JavaScript
- Title
- javascript audio stop
- Category
- JavaScript
- Title
- convert string with dot or comma as decimal separator to number in javascript
- Category
- JavaScript
- Title
- div background image chnage uisng js
- Category
- JavaScript
- Title
- how to use session using javascript
- Category
- JavaScript
- Title
- angular check if control has required validator
- Category
- JavaScript