Good evening. We need a function that would compare all td cells for content.
For example, there are 5 cells. It is necessary that the logical if operator compares with an example and gives me an answer (true / false)
It is for certain clear that the written function below works not how it is necessary to me. I understand the principle of operation of this function, but I myself cannot write the one that I need for which day
function proverka() { var myTable = document.getElementById("myTable"); for (var i = 0, row; row = myTable.rows[i]; i++) { for (var j = 0, col; col = row.cells[j]; j++) { if (myTable.rows[0].cells[i].innerText == myTable.rows[0].cells[i].innerText && myTable.rows[0].cells[i].innerText == "X") { cnsole.log("verj") } } } }
myTable.rows[0].cells[i].innerTextwith yourself? And the variablejnot used anywhere! - sercxjo