const form = document.querySelector('form')
const purchaseTypeInput = form.querySelector('[name=purchase_type]')
const scheduleInput = form.querySelector('[name=schedule]')

scheduleInput.parentElement.style.display = 'none'

purchaseTypeInput.addEventListener('change', event => {
    if (event.target.value === 'Subscribe') {
        scheduleInput.parentElement.style.display = 'block'
    } else if (event.target.value === 'One-time purchase') {
        scheduleInput.parentElement.style.display = 'none'
    }

})
