this question ruined my evening.
I wanna make a simple filter for abstract clothes.
Rangę value + data-price.
When user pick range number ( 125$* or no matter ), code will counting his pick and check data-price value.
BUT I have problem.
The loop skips some items.
priceSelect.addEventListener('input', () => {
let priceValue = document.querySelector('.price_select').value;
document.querySelector('.price_result').innerHTML = 'Ваша цена : ' + priceValue;
for (let f = 0; f < filterItems.length; f++) {
let getPrice = filterItems[f].dataset['price'];
if (priceValue < getPrice) {
console.log('test');
}
}
})
For example, I specified the following condition.
If the entered number is less than the price of the item, write a test to the console. Shows 3 times when it should be 1.
Help me pls guys. And sry for bad eng. Thx you !