Answer the question
In order to leave comments, you need to log in
Why does it find only the very first date attribute when there are more of them in the element?
There is an element in which there are two date attributes with the same name, but different values, when I search in JS using dataset, it finds only the first date attribute.
Why and how to fix it, or how to do it right from the start?
HTML
<div class="content-item" data-filters="Bluetooth" data-filters="google-assistant"></div>
console.log(card.dataset.filters);
Answer the question
In order to leave comments, you need to log in
try to make 1 data-filters, and enter all the necessary values \u200b\u200bseparated by commas into it, then use js to transfer them to an array.
<div class="content-item" data-filters="Bluetooth,google-assistant"></div>
console.log(card.dataset.filters.split(','));
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question