decentralized-video-chat/public/js/pricing-switcher.js

23 lines
701 B
JavaScript
Raw Normal View History

2020-03-24 11:20:28 +08:00
;(function () {
'use strict'
const pricingToggle = document.getElementById('pricing-toggle')
if (pricingToggle) {
window.addEventListener('load', pricingSwitch)
pricingToggle.addEventListener('change', pricingSwitch)
}
function pricingSwitch () {
const switchables = document.getElementsByClassName('pricing-switchable')
if (pricingToggle.checked) {
for (let i = 0; i < switchables.length; i++) {
switchables[i].innerHTML = switchables[i].getAttribute('data-pricing-yearly')
}
} else {
for (let i = 0; i < switchables.length; i++) {
switchables[i].innerHTML = switchables[i].getAttribute('data-pricing-monthly')
}
}
}
}())