https://jsfiddle.net/zcyykhow/
Должен выделяться только один checkbox
.
Что не так я сделал?
$(".lines").click(function() {
if ($(this).find(".ch").is(":checked")) {
$(".ch").removeAttr("checked");
} else {
$(".ch").attr("checked", "checked");
}
});
.lines {
width: 100%;
padding: 10px 0 10px 0;
background-color: #FFFFFF;
overflow: hidden;
font-weight: 500;
font-size: 17px;
}
.lines:hover {
background-color: #F5F5F5;
cursor: pointer;
}
.tab1_unvisible {
float: left;
width: 10%;
padding: 8px 0 8px 0;
text-align: center;
}
.tab2 {
float: left;
width: 64%;
padding: 8px 2% 8px 0;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.tab3 {
float: left;
width: 9%;
padding: 8px 0 8px 0;
}
.tab4 {
float: left;
width: 15%;
padding: 8px 0 8px 0;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js"></script>
<div class="lines">
<div class="tab1_unvisible">
<input class="ch" type="checkbox">
</div>
<div class="tab2">Tesla Model S (2015)</div>
<div class="tab3">11</div>
<div class="tab4">$120 000</div>
</div>
<div class="lines">
<div class="tab1_unvisible">
<input class="ch" type="checkbox">
</div>
<div class="tab2">Tesla Model S (2015)</div>
<div class="tab3">11</div>
<div class="tab4">$120 000</div>
</div>