Сообщение от Diiim
|
Уже 3-ий день не могу решить данную задачку
|
Как вариант...
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<script src="https://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
<!--
-->
<style>
.on {
color: red;
}
</style>
<script>
$(() => {
$('.filter-content').on('click', 'input', e => {
test()
})
test()
//
function test() {
const o = $('.filter-wrapp')
if (o.find('input:checked').length === 0) {
o.removeClass('on')
} else {
if (!o.hasClass('on')) o.addClass('on')
}
}
})
</script>
</head>
<body>
<div class="filter-wrapp"> сюда добавляем класс One
<div class="filter-content">
<ul>
<li><input type="checkbox" checked="checked"></li>
<li><input type="checkbox"></li>
</ul>
</div>
</div>
</body>
</html>