-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
25 lines (21 loc) · 1004 Bytes
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
function toggleBilling() {
const toggleSwitch = document.getElementById('toggle');
const priceElements = document.querySelectorAll('.price');
priceElements.forEach(priceElement => {
const currentPrice = parseFloat(priceElement.textContent);
const newPrice = toggleSwitch.checked ? currentPrice * 12 : currentPrice / 12;
priceElement.textContent = newPrice.toFixed(2);
});
const unitElements = document.querySelectorAll('.unit');
unitElements.forEach(unitElement => {
unitElement.textContent = toggleSwitch.checked ? 'year' : 'month';
});
}
function toggleCurrency() {
const currencyToggleSwitch = document.getElementById('currency-toggle');
const currencyElements = document.querySelectorAll('.currency');
currencyElements.forEach(currencyElement => {
const currentCurrency = currencyElement.textContent;
currencyElement.textContent = currencyToggleSwitch.checked ? '₹' : '$';
});
}