From ba758379b7494e7e43b94124622b23c643d09e25 Mon Sep 17 00:00:00 2001 From: Subhranil Patra Date: Mon, 23 Jun 2025 13:51:05 +0530 Subject: [PATCH] Update JavaScript lesson: improved HTML, CSS, and JS in Lesson 1 --- Introduction to JavaScript/Lesson 1/index.html | 7 ++++--- Introduction to JavaScript/Lesson 1/store.js | 4 +++- Introduction to JavaScript/Lesson 1/styles.css | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Introduction to JavaScript/Lesson 1/index.html b/Introduction to JavaScript/Lesson 1/index.html index 57ae0953..ffebea4b 100644 --- a/Introduction to JavaScript/Lesson 1/index.html +++ b/Introduction to JavaScript/Lesson 1/index.html @@ -1,9 +1,10 @@ - The Generics - - + + + The Generics - Official Website +
diff --git a/Introduction to JavaScript/Lesson 1/store.js b/Introduction to JavaScript/Lesson 1/store.js index 73c33d78..b2fc9262 100644 --- a/Introduction to JavaScript/Lesson 1/store.js +++ b/Introduction to JavaScript/Lesson 1/store.js @@ -83,9 +83,11 @@ function addItemToCart(title, price, imageSrc) { cartRow.innerHTML = cartRowContents cartItems.append(cartRow) cartRow.getElementsByClassName('btn-danger')[0].addEventListener('click', removeCartItem) - cartRow.getElementsByClassName('cart-quantity-input')[0].addEventListener('change', quantityChanged) + cartRow.getElementsByClassName('cart-quantity-input')[0].addEventListener('change', quantityChanged) + updateCartTotal() // Call updateCartTotal after adding a new item } + function updateCartTotal() { var cartItemContainer = document.getElementsByClassName('cart-items')[0] var cartRows = cartItemContainer.getElementsByClassName('cart-row') diff --git a/Introduction to JavaScript/Lesson 1/styles.css b/Introduction to JavaScript/Lesson 1/styles.css index 045b85bb..06bc8cdb 100644 --- a/Introduction to JavaScript/Lesson 1/styles.css +++ b/Introduction to JavaScript/Lesson 1/styles.css @@ -324,7 +324,7 @@ html, body { .cart-total-title { font-weight: bold; font-size: 1.5em; - color: black; + color: #000; margin-right: 20px; }