Answer the question
In order to leave comments, you need to log in
Why doesn't the state of the radiobutton change when clicking on the label?
I want to make beautiful buttons, but when you click on the label, nothing happens, although when you hover over the label, there is a glare on the radiobutton.
When you click on the circle itself, everything works, but for styling, you need to click on the label.
I took the layout from the bootstrap site and it works there when I click on the label, but I don’t understand what’s the catch. I
display the radio in a loop
<form class="form-inline" data-toggle="buttons" data-id="size" id="size">
<?php foreach ($product->sizes as $size): ?>
<div class="form-check">
<input class="form-check-input" name="size" type="radio" id="<?= $size->name ?>" value="<?= $size->name ?>" />
<label class="form-check-label" for="<?= $size->name ?>"><?= $size->name ?></label>
</div>
<?php endforeach; ?>
</form>
Answer the question
In order to leave comments, you need to log in
And dug himself, after writing the question.
Maybe someone else will come in handy
Add js and rejoice
$('.form-check').click(
function(){
$(this).find(':radio').attr('checked','checked');
//выделение всех чекбоксов на кликнутом контейнере, снять выделение через removeAttr("checked")
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question