JSFiddle - React, Tailwind, and code Playground
by nessajtr
HTML
<link rel="stylesheet" href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css">
<table class="table yarak">
<thead>
<tr>
<th>Col 1</th>
<th>Col 2</th>
<th>Col 3</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>Data 1</strong></td>
<td>Data 2</td>
<td>Data 3</td>
</tr>
<tr>
<td><strong>Data 1</strong></td>
<td>Data 2</td>
<td>Data 3</td>
</tr>
<tr>
<td><strong>Data 1</strong></td>
<td>Data 2</td>
<td>Data 3</td>
</tr>
</tbody>
</table>
CSS
.bg{background-color:#ff0000 !important;}
JavaScript
$(document).ready(function(){
$('.yarak tr').on('click', function () {
$(this).closest('table').find('td').css('background-color','#ffaaaa')
$(this).find('td').css('background-color','#FF0000');;
/*
var res1 = $(this).closest('.table').find('td');
res1.each(function(result) {
res1[result].style.backgroundColor= "#FFFFFF";
});
console.log(res1.length);
var res = $(this).find('td');
res.each(function(result){
res[result].style.backgroundColor= "#ff0000";
});
*/
});
});