Is it possible to use javascript to style a specific cell in an HTML table?
A sample HTML table is provided below:
<table border="1" width="300" height="200">
<tr>
<td id="11"><</td>
<td id="12"></td>
<td id="13"></td>
<td id="14"></td>
<td id="15"></td>
<td id="16"></td>
<td id="17"></td>
<td id="18"></td>
<td id="19"></td>
<td id="20"></td>
</tr>
</table>
<style>
table {
border-collapse: collapse;
}
td {
border: 1px solid grey;>
}
</style>
I am looking to dynamically change the color of cell with id 11 to black based on a condition
I have attempted to achieve this using JS, but so far no success
function bthClick(){
let table = document.querySelectorAll('td id')
table[11].style.color = 'dark'
}