How can I get the id of the alternative and know if it is 0, 1 or 2.
<div class="quest-alternatives">
<p class="brand-alternative">
<span class="brand-id hidden" style="display: none;">123</span>
<span class="radio-button" id="brand-0"></span>
<label for="brand-0" class="brand-name">Opção 0</label></p>
<p class="brand-alternative">
<span class="brand-id hidden" style="display: none;">456</span>
<span class="radio-button" id="brand-1"></span>
<label for="brand-1" class="brand-name">Opção 1</label></p>
<p class="brand-alternative">
<span class="brand-id hidden" style="display: none;">789</span>
<span class="radio-button" id="brand-2"></span>
<label for="brand-2" class="brand-name">Opção 2</label></p></div>
I used $('span.brand-id.hidden').html()
but it only returned me the id of the first alternative
I also tried to use $.each
but I do not quite understand how it works.