forked from Luson045/medi-connect
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b2760e9
commit 7ce22c5
Showing
1 changed file
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
document.addEventListener('DOMContentLoaded', function () { | ||
// Toggle between Monthly and Yearly Pricing | ||
const toggleSwitch = document.querySelector('#toggle-pricing'); | ||
const priceElements = document.querySelectorAll('.price'); | ||
|
||
toggleSwitch.addEventListener('change', function () { | ||
const isYearly = toggleSwitch.checked; | ||
|
||
priceElements.forEach(priceElement => { | ||
const monthlyPrice = priceElement.getAttribute('data-monthly'); | ||
const yearlyPrice = priceElement.getAttribute('data-yearly'); | ||
|
||
if (isYearly) { | ||
priceElement.innerText = yearlyPrice; | ||
} else { | ||
priceElement.innerText = monthlyPrice; | ||
} | ||
}); | ||
}); | ||
|
||
// Handle Plan Selection | ||
const buttons = document.querySelectorAll('.btn-select'); | ||
buttons.forEach(button => { | ||
button.addEventListener('click', function () { | ||
const selectedPlan = this.closest('.pricing-card').querySelector('h2').innerText; | ||
alert('You have selected the ' + selectedPlan + ' plan.'); | ||
}); | ||
}); | ||
|
||
// Optional: Add selected plan to cart or process payment (custom logic can go here) | ||
function addToCart(plan) { | ||
console.log(plan + ' added to cart.'); | ||
// Add additional logic here for payment processing or cart functionality | ||
} | ||
}); |