Всем привет) Нужна помощь) Есть чекбоксы, при нажатии на которые происходит фильтрация в зависимости от их значения, если выбрано несколько чекбоксов то и фильтроваться должно по обоим условиям
<form class="map__filters">
<fieldset id="housing-features" class="map__features">
<input type="checkbox" name="features" value="wifi" id="filter-wifi" class="map__checkbox">
<label for="filter-wifi">Wi-Fi</label>
<input type="checkbox" name="features" value="dishwasher" id="filter-dishwasher" class="map__checkbox">
<label for="filter-dishwasher">Посудомоечная машина</label>
<input type="checkbox" name="features" value="parking" id="filter-parking" class="map__checkbox">
<label for="filter-parking">Парковка</label>
<input type="checkbox" name="features" value="washer" id="filter-washer" class="map__checkbox">
<label for="filter-washer">Стиральная машина</label>
<input type="checkbox" name="features" value="elevator" id="filter-elevator" class="map__checkbox">
<label for="filter-elevator">Лифт</label>
<input type="checkbox" name="features" value="conditioner" id="filter-conditioner" class="map__checkbox">
<label for="filter-conditioner">Кондиционер</label>
</fieldset>
</form>
const data = [
{
"features": [
"wifi",
"parking",
"washer",
"elevator"
]
},
{
"features": [
"wifi",
"dishwasher",
"parking"
]
},
{
"features": [
"dishwasher",
"parking",
"washer",
"elevator",
"conditioner"
]
}
];
const form = document.querySelector('.map__filters');
form.addEventListener('change', () => {
const housingFeatures = document.querySelectorAll('#housing-features input:checked');
console.log(housingFeatures)
});