V
V
Viktor Petrov2021-06-29 16:26:17
JavaScript
Viktor Petrov, 2021-06-29 16:26:17

How to make a checkbox inactive when a select value is selected?

Hello, how to implement using JS so that when choosing a size from the select from the checkbox, the M size becomes inactive

<select name="selectsize" id="" class="modal-select" required>
                <option selected disabled value="">Выберите размер</option>
                <option value="S">S</option>
                <option value="M">M</option>
                <option value="L">L</option>
                <option value="XL">XL</option>
              </select>

<div class="modal-checkbox">
                <label><input type="checkbox" name="selectcolor[]" value="Черный">Черный</label></br>
                <label><input type="checkbox" name="selectcolor[]" value="Красный">Красный</label></br>
                <label><input type="checkbox" name="selectcolor[]" value="Розовый">Розовый</label></br>
                <label><input type="checkbox" name="selectcolor[]" value="Леопард">Леопард</label></br>
              </div>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Miller, 2021-06-30
@Dewembas

The question is not very clear.

$('select').on('change', function(){
if($(this).val() == 'какой-то размер'){
$('.checkbox').prop('checked', false);
}

});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question