// BDMDecision: the slider's handle stays hidden and Next stays disabled until // the participant actually interacts with it, so no default value slips // through unnoticed. First interaction reveals the handle and the dollar // readout at wherever they landed. (function () { var slider = document.getElementById('bdm-slider'); var label = document.getElementById('bdm-slider-value'); var nextBtn = document.querySelector('.otree-btn-next'); if (nextBtn) nextBtn.disabled = true; function money(cents) { return '$' + (cents / 100).toFixed(2); } function onInput() { slider.classList.add('touched'); label.classList.add('touched'); label.textContent = money(parseInt(slider.value, 10)); if (nextBtn) nextBtn.disabled = false; } slider.addEventListener('input', onInput); })();