Answer the question
In order to leave comments, you need to log in
How to get the values of all inputs at once by the date attribute in js?
For example, there is such a layout and by the attribute data-checked="checked" you need to get the value of all inputs
<input class='radio3' type="checkbox" data-checked="checked" value="1-е значение">
<input class='radio3' type="checkbox" data-checked="checked" value="2-е значение">
<input class='radio3' type="checkbox" data-checked="checked" value="3-е значение">
Answer the question
In order to leave comments, you need to log in
radios = document.getElementsByClassName('radio3')
for(let i=0; i< radios.length; i++) {
if(radios[i].getAttribute('data-checked') === 'checked') {
console.log(radios[i].value)
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question