Here i'm trying to change the color based on value and rest of should be in white background, if input value is 1 then it should highlighted to red , if i changed the value to 4 then it should be highlighted in to red and rest of values 1 should be in white
I am still learning,Thanks in advance
<table>
<tr>
<td id="data1">1</td>
<td>2</td>
<td>3</td>
</tr>
<tr>
<td>4</td>
<td>5</td>
<td>6</td>
</tr>
<tr>
<td>7</td>
<td>8</td>
<td>9</td>
</tr>
</table>
<input type="text" id="valuesData" />
<button onclick="myFunction()" value="click me"></button>
</body>
<script>
function myFunction(){
if(document.getElementById('valuesData').value >= '9'){
document.getElementById('data1').style.background='red'
}
else{
alert("value should not be greater than 9");
}
}
</script>