JSFiddle - React, Tailwind, and code Playground
by Allendar
HTML
<table id="table1">
<tr>
<th>1</th>
<th>2</th>
</tr>
<tr>
<td>1 text</td>
<td>2 text</td>
</tr>
</table>
<input type="text" id="textColor" value="" />
<button onclick="checkbutton();">Click me</button>
CSS
#table1 {
border-collapse: collapse;
}
#table1 th, #table1, td {
border: 1px solid blue;
padding: 5px;
}
JavaScript
function checkbutton() {
var color = document.getElementById("txtColor");
var table1 = document.getElementById("table1");
table.getElementsByTagName('td').style.color = color;
console.log(color);
}