As a student at Brightfield Tech Academy who have learned the HTML, CSS and the basics of JavaScript, You are require to build a Book Management System which is a web-based application that allows librarians to manage books in a library. The system allows librarians to add,read, edit, and delete books in the library's inventory.
- Learn how to get user input from HTML form.
- Learn how to display data received in HTML form to the UI.
- Learn how to use
localStorage
to store data. - Learn how to use proper ES6 syntax.
- Understand improvements that ES6 brings to JavaScript.
- Understand how to use
class
andobject
in JavaScript. - Understand the
addEventListener
method and how to use it.
Make sure that you create a github repository for your project. Create an index.html
file for your html code, a script.js
file for your JavaScript code and a seperate CSS file if you are going to style your project to make your project looks good 👍. Commit and push your changes to the remote repository after each task.
- Create a form to get user input
- The form should have the following fields:
- Book title
- Author
- ISBN (International Standard Book Number)
- The form should have a submit button
- The form should have a reset button
- [optional] Add style to the form using CSS
- [optional] Add validation to the form using JavaScript
- Display data received from the form to the UI :
- How to read data from the form
- Get the form element
- Get the value of each input field and store it in a variable in the
submit
event handler in a form of an objectbook
- How to display the data to the UI
- Get the table element in the DOM
- Create a new row and append it to the table
- Create a new cell for each field and append it to the row
- Set the value of each cell to the value of each field
- How to read data from the form
- [optional] Add style to the table using CSS
localStorage
is a property of the window
object. It allows you to store data in the browser. The data will not be deleted when the browser is closed. It will be deleted only when you clear the browser cache.
- How to store data to
localStorage
- Convert the
book
object to a string usingJSON.stringify(book)
- Use
localStorage.setItem('books', bookString)
to store the string tolocalStorage
- Convert the
- How to get data from
localStorage
- Use
localStorage.getItem('books')
to get the string fromlocalStorage
- Convert the string to an object using
JSON.parse(bookString)
- Display the data to the UI
- Use
PLEASE NOTE: 🙏 Before you get to the next step, you should have your application working properly. You should be able to add a book to the table and the data should be stored in the localStorage
. You should be able to see the data in the table when you refresh the page.
-
Add a delete button to each row in the table
-
Add an event listener to the delete button
-
Delete the row from the table
-
Delete the data from the
localStorage
- Add a search bar to the UI
- Add an event listener to the search bar
- Filter the data in the table based on the search term
- Display the filtered data to the UI
If you spot any bugs or issues in this activity, you can open an issue with your proposed change.