diff --git a/conservancy/static/js/conservancy.js b/conservancy/static/js/conservancy.js index db482368..06e2ef36 100644 --- a/conservancy/static/js/conservancy.js +++ b/conservancy/static/js/conservancy.js @@ -8,11 +8,11 @@ 'use strict'; function qs (selector, parent) { - return document.querySelector(selector); + return parent ? parent.querySelector(selector) : document.querySelector(selector); } function qsa (selector, parent) { - return document.querySelectorAll(selector); + return parent ? parent.querySelectorAll(selector) : document.querySelectorAll(selector); } function hide(el) { @@ -33,13 +33,14 @@ function showVideoInnerHTML (event) { function toggleShirtSize (form) { let wantShirt = form.elements['on0'].value === 'wantGiftYes'; - let shirtSizeSelector = form.elements['os0']; - shirtSizeSelector.disabled = !wantShirt; + let shirtSizeRow = qs('.t-shirt-size-selector', form); + let shirtSizeSelect = form.elements['os0']; + shirtSizeSelect.disabled = !wantShirt; form.elements['no_shipping'].value = wantShirt ? '2' : '0'; if (wantShirt) { - show(shirtSizeSelector); + show(shirtSizeRow); } else { - hide(shirtSizeSelector); + hide(shirtSizeRow); } }