<form id="book-form"> <div class="form-group"> <input type="submit" value="Add Book" class="btn btn-primary btn-block"> </form>
document.querySelector('#book-form').addEventListener('submit', (e) => { // Prevent actual submit e.preventDefault(); // Get form values } });
Every time I open the console, the Uncaught TypeError: document.querySelector(...) is null is shown up and the whole code didn't run properly.