Gitlab@Informatics

Skip to content
Snippets Groups Projects
Commit a69a1bbf authored by 65160270's avatar 65160270
Browse files

update-server

parent d2a91a26
No related branches found
No related tags found
No related merge requests found
......@@ -63,8 +63,10 @@
</div>
<script>
// อัปเดตจำนวนสินค้า
document.querySelectorAll(".update-btn").forEach(button => {
button.addEventListener("click", async (event) => {
event.stopPropagation(); // ป้องกันการรบกวนกับปุ่มอื่น
const cartItem = event.target.closest(".cart-item");
const cartItemId = cartItem.dataset.id;
const quantity = cartItem.querySelector("input[name='quantity']").value;
......@@ -82,6 +84,19 @@
}
});
});
// เปิดปุ่ม Remove เมื่อกด Edit
document.querySelectorAll(".edit-btn").forEach(button => {
button.addEventListener("click", (event) => {
event.stopPropagation(); // ป้องกัน event ซ้อนทับ
const cartItem = event.target.closest(".cart-item");
const removeForm = cartItem.querySelector(".remove-form");
const editButton = cartItem.querySelector(".edit-btn");
editButton.style.display = "none"; // ซ่อนปุ่ม Edit
removeForm.style.display = "block"; // แสดงปุ่ม Remove
});
});
</script>
<% } %>
</div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment