Skip to content

Commit

Permalink
0.1.24
Browse files Browse the repository at this point in the history
script update
  • Loading branch information
EDU-MDAnderson committed Sep 25, 2023
1 parent e5600df commit 39a0f0b
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 2 deletions.
5 changes: 3 additions & 2 deletions week02/bom.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@
<link rel="stylesheet" type="text/css" href="../styles/larger.css">
<link rel="icon" href="../images/favicon.ico" />
<meta name="author" content="Matthew Anderson"/>
<script src="bom.js"></script>
<title>Student Placeholder Page WDD230</title>
</head>

<body>
<nav>
<ul>
<li><a href="index.html" class="active">Home</a></li>
<li><a href="underconstruction.html" class="active">Chamber</a></li>
<li><a href="index.html">Home</a></li>
<li><a href="underconstruction.html">Chamber</a></li>
<li><a href="week01/chamber-site-plan.html">Site Plan</a></li>
<li><a href="underconstruction.html">Form</a></li>
</ul>
Expand Down
31 changes: 31 additions & 0 deletions week02/scripts/bom.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
document.addEventListener('DOMContentLoaded', function() {
const input = document.querySelector('#favchap');
const button = document.querySelector('#addChapterButton');
const list = document.querySelector('#list');

button.addEventListener('click', function() {
if (input.value.trim() !== '') {
const li = document.createElement('li');
const deleteButton = document.createElement('button');

li.textContent = input.value;
deleteButton.textContent = '❌';

li.append(deleteButton);
list.append(li);

deleteButton.addEventListener('click', function() {
list.removeChild(li);
input.focus();
});

input.value = '';
} else {
// Provide a message or alert the user to enter a book and chapter.
// You can use alert or some other method to communicate this to the user.
// For example:
// alert('Please enter a book and chapter.');
input.focus();
}
});
});
File renamed without changes.

0 comments on commit 39a0f0b

Please sign in to comment.