1
I need you to click on checkbox
paint the background
of tr
and input.
In the code below it paints only the background
of tr
and clicking anywhere from tr
.
<html>
<head>
<script src="//code.jquery.com/jquery-2.1.0.min.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
<script>
$(document).ready(function(){
$('.table tr').click(function(){
$trClass = $(this).attr('class');
if ($trClass == undefined || $trClass == 'desclicado'){
$(this).attr('class', 'clicado');
} else {
$(this).attr('class', 'desclicado');
}
});
});
</script>
<style>
.clicado{background: #000; color:#fff;}
.desclicado{background: #fff; color: #000;}
</style>
</head>
<body>
<table class="table">
<td><input type="text"></td>
<td><input type="text"></td>
<td><input type="text"></td>
<td><input type="checkbox"></td></tr>
</table>
</body>
</html>