document.addEventListener('change', function(e) { if (e.target.classList.contains('toggle-size')) { const targetId = e.target.getAttribute('data-target'); const targetBox = document.getElementById(targetId); if (targetBox) { if (e.target.checked) { targetBox.style.display = 'block'; } else { targetBox.style.display = 'none'; // チェックを外したときに中の入力や下層のチェックもリセットしたい場合 const inputs = targetBox.querySelectorAll('input, select'); inputs.forEach(input => { if (input.type === 'checkbox') input.checked = false; if (input.tagName === 'SELECT') input.selectedIndex = 0; if (input.type === 'number') input.value = ''; }); // さらに下層のボックスも隠す const subBoxes = targetBox.querySelectorAll('.extra-size-box'); subBoxes.forEach(box => box.style.display = 'none'); } } } });

イラスト素材ダウンロード(このちゃん)

LINE素材ダウンロード(このちゃん)

このちゃんLINEスタンプ画像

TOP