Hello I would like to know how I could set the data-value using javascript
i have this:
optionsList.forEach((o) => {
o.addEventListener("click", () => {
selected.innerHTML = o.querySelector("label").innerHTML;
let input = o.querySelector("input").value;
optionsContainer.classList.remove("active");
});
});
I take the value of my input which is an id and I wanted to set the data-value in my selected element
like this:
<div class="selected" data-value="1">
Select Video Category
</div>
I need this value to do an array search
my input structure: