Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update #679

Merged
merged 1 commit into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 0 additions & 25 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -689,31 +689,6 @@ <h2>Feedback Form</h2>
</svg>
</button>

<script>
let cartItemCount = 0;
// document.querySelectorAll('#cart-btn').addEventListener('click', function () {
// cartItemCount++; // Increment cart count
// document.getElementById('cart-count').textContent = cartItemCount; // Update cart count display
// alert('Item added to cart'); // Show alert
// });


const cartButtons = document.querySelectorAll('#cart-btn');
cartButtons.forEach(button => {
button.addEventListener('click', function () {
cartItemCount++; // Increment cart count
document.getElementById('cart-count').textContent = cartItemCount; // Update cart count display
alert('Item added to cart'); // Show alert
});
});
// Function to handle Add to Cart button click
// document.getElementById('cart-btn').addEventListener('click', function () {
// cartItemCount++; // Increment cart count
// document.getElementById('cart-count').textContent = cartItemCount; // Update cart count display
// alert('Item added to cart'); // Show alert
// });

</script>
<script src="https://unpkg.com/swiper/swiper-bundle.min.js"></script>

<script>
Expand Down
11 changes: 10 additions & 1 deletion script.js
Original file line number Diff line number Diff line change
Expand Up @@ -478,4 +478,13 @@ function clearForm() {
// Load the form data when the page is loaded
window.onload = loadFormData;


let cartItemCount = 0;

const cartButtons = document.querySelectorAll('#cart-btn');
cartButtons.forEach(button => {
button.addEventListener('click', function () {
cartItemCount++; // Increment cart count
document.getElementById('cart-count').textContent = cartItemCount; // Update cart count display
alert('Item added to cart'); // Show alert
});
});
Loading