Skip to content

Update JavaScript lesson: improved HTML, CSS, and JS in Lesson 1 #63

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
7 changes: 4 additions & 3 deletions Introduction to JavaScript/Lesson 1/index.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<!DOCTYPE html>
<html>
<head>
<title>The Generics</title>
<meta name="description" content="This is the description">
<link rel="stylesheet" href="styles.css" />
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>The Generics - Official Website</title>
<link rel="stylesheet" href="styles.css?v=20250101" />
</head>
<body>
<header class="main-header">
Expand Down
4 changes: 3 additions & 1 deletion Introduction to JavaScript/Lesson 1/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
2 changes: 1 addition & 1 deletion Introduction to JavaScript/Lesson 1/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ html, body {
.cart-total-title {
font-weight: bold;
font-size: 1.5em;
color: black;
color: #000;
margin-right: 20px;
}

Expand Down