there is a table, inside <td>
there is a numeric value, how to get to it via javascript?
|
1 answer
Here start and look:
var tds = document.getElementsByTagName("td");//возвращает массив всех <td> for (var i = 0; i < tds.length; i++) { alert(tds[i].innerHTML);//выводим числовое значение каждого <td> }
- Thank you very much, tell me, how can I track the cell number when I click on it? It is necessary that when clicking on a cell, it would give its serial number. - pzb
- <td onclick = "alert (this.innerHTML);"> - Autocrab
- Faced another problem, in any case, click gives out undefined, do not tell what could be the problem? - pzb
- I won't tell you without html - Autocrab
|
element.innerHTML
[1]: developer.mozilla.org/en-US/docs/Web/API/… - RubaXa