This sounds like the stupidest problem I’ve ever encountered, but this simple thing doesn’t work. The page refreshes every time I press ‘Submit’ button. Any ideas why?
Here is my code:
const submitBtn = document.querySelector('.submit-btn');
const submitForm = function (event) {
event.preventDefault();
console.log('Hi');
};
submitBtn.addEventListener('submit', submitForm);
<form>
<label>Input your facebook profile URL</label>
<input type="text" />
<button class="submit-btn">Submit</button>
</form>