Tell us what’s happening:
I have run my code and it says that I have not linked my script page to my HTML page, I clearly have. I am curious if anyone else is having this issue
Your code so far
<!-- file: index.html -->
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>Cash Register</title>
<link rel="stylesheet" href="./styles.css" />
</head>
<body>
<input id = "cash"></input>
<div id = "change-due"></div>
<button id = "purchase-btn"></button>
<script src = "./script.js"></script>
</body>
</html>
/* file: script.js */
let price = 1.87;
let cid = [
['PENNY', 1.01],
['NICKEL', 2.05],
['DIME', 3.1],
['QUARTER', 4.25],
['ONE', 90],
['FIVE', 55],
['TEN', 20],
['TWENTY', 60],
['ONE HUNDRED', 100]
];
const cash = document.getElementById("cash");
const change = document.getElementById("change-due");
const sale = document.getElementById("purchase-btn");
let currencyUnits = [
['PENNY', 01],
['NICKEL', 05],
['DIME', .1],
['QUARTER', .25],
['ONE', 1],
['FIVE', 5],
['TEN', 10],
['TWENTY', 20],
['ONE HUNDRED', 100]
];
sale.addEventListener("click", () => {
const cashValue = parseFloat(cash.value)
const changeDue = cashValue - price;
});
/* file: styles.css */
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36
Challenge Information:
Build a Cash Register Project - Build a Cash Register