How do I change the <td> color when I click on the cell ? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
0

How do I change the <td> color when I click on the cell ?

10th Jul 2017, 6:42 PM
Manik Tafralian
Manik Tafralian - avatar
3 Respostas
+ 5
<td onclick="this.style.color='red'">...</td> Obviously, if you was meaning 'background' color use this.style.backgroundColor or any css property ^^
10th Jul 2017, 7:16 PM
visph
visph - avatar
+ 3
Same, but applied on <tr> element...
10th Jul 2017, 8:58 PM
visph
visph - avatar
0
And what about changing the color of the entire row?
10th Jul 2017, 8:48 PM
Manik Tafralian
Manik Tafralian - avatar