How could resetar
a CSS applied with Javascript
via Click element? I have a table whose tr
and td
are dynamically created and a table
table is created directly in% static%, HTML
of course does not have td
this CSS
is applied when CSS
is clicked because I do not want to delete the td
of the other CSS
siblings of td
clicked.
HTML Table Code:
<table id="palavras">
<tbody>
<tr>
<td>Cadillac</td>
</tr>
<tr>
<td>Cachorro</td>
</tr>
<tr>
<td>Camaro</td>
</tr>
</tbody>
</table>
Javascript code resposable by adding td
(fucnionando) and disallowing siblings of the element clicked:
$('body').on('click', ' #palavras td', function (e){
$(this).css('background-color', '#333');
$(this).siblings().css('background-color', '#fff');
});