lundi 22 février 2016

jQuery - get value of checked checkbox that has a certain class

I'd like to get the value of the checked checkbox that has the radioListMode class:

<label class="btn btn-secondary active">
    <input type="radio" class="radioListMode" value="cards" checked>Cards
</label>
<label class="btn btn-secondary">
    <input type="radio" class="radioListMode" value="pins">Pins
</label>

From this previous question, this is what I have tried and it is undefined:

console.log($('input[class="radioListMode"]:checked').value);

I do not wish to add a name because the value of this checkbox is only used for layout selection, not any data input.




Aucun commentaire:

Enregistrer un commentaire