Fix shirt size for monthly an annual renew

This commit is contained in:
Ben Sturmfels 2024-05-08 18:05:27 +10:00
parent 0d25e1a87d
commit fb690c1676
Signed by: bsturmfels
GPG key ID: 023C05E2C9C068F0

View file

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