Делайте ваш выбор:
<br />
<input name="test" type="radio" value="1">Вариант 1</input>
<input name="test" type="radio" value="2">Вариант 2</input>
<input name="test" type="radio" value="3">Вариант 3</input>
<br />
<span id="locked" class="hidden">Выбор зафиксирован</span>
.hidden {
display: none;
}
const lockInput = () => {
[document.querySelectorAll('[name="test"]:not(:checked)')]
.forEach(el => {
el.setAttribute('disabled', 'disabled')
})
document.querySelector('#locked').classList.remove('hidden')
}
[document.querySelectorAll('[name="test"]')]
.forEach(el => {
el.addEventListener('change', lockInput)
})
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.