I am learning JS and have a page done in vanilla JS and HTML and for the life of me cannot figure out why when I hit submit, the page refreshes. Please help! I have double checked the ID for the form that I have the event listener on and it is correct.
// Book Constructor
function Book(title, author, isbn) {
this.title = title;
this.author = author;
this.isbn = isbn;
}
// UI Constructor
function UI() {}
// Event Listeners
document.getElementById('book-form').addEventListener('submit', function(e){
const title = document.getElementById('title').value,
author = document.getElementById('author').value,
isbn = document.getElementById('isbn').value
console.log(title, author, isbn);
e.preventDefault();
});