Если вы хотите, чтобы в любой момент был выбран только один вопрос, почему бы не использовать вместо него «радио»?
Поместите их в элемент div, который можно прокручивать.
Дайте им тот же атрибут name.
Дайте им EventListener 'change', зациклите их и возьмите значение из проверяемого.
<div class="myContainer">
<label>
<input class="myInput" type="radio" name="selectQuestion" value="My Question here..."/>
My Question here...
</label>
<label>
<input class="myInput" type="radio" name="selectQuestion" value="My Question here..."/>
My Question here...
</label>
</div>
.container {
height: 400px;
overflow-y: auto;
}
var targets = Array.from(document.getElementsByClassName('myInput'));
targets.map(function(item){
target.addEventListener('change', function(e){
if (e.target.checked) { //do stuff }
})
})
В противном случае, если в любой момент можно выбрать несколько вопросов,просто создайте невидимые элементы div с помощью clickL eventListeners, или входы 'checkbox' с 'change' eventListeners.
<div class="myContainer">
<label>
<input class="myInput" type="checkbox" value="My Question here..."/>
My Question here...
</label>
<label>
<input class="myInput" type="checkbox" value="My Question here..."/>
My Question here...
</label>
</div>
Мнения о выборе дизайна здесь довольно сложны.