From fb690c16763a6509235b5a48475739f3cd650939 Mon Sep 17 00:00:00 2001 From: Ben Sturmfels Date: Wed, 8 May 2024 18:05:27 +1000 Subject: [PATCH] Fix shirt size for monthly an annual renew --- conservancy/static/js/conservancy.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) 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); } }