The callback function code refused to render on my console as expected…what could be the issue?
FormEl = document.getElementById ("form");
FormEl.addEventListener( "Submit",() =>{
Const userInput = inputNum.value
Console.log (userInput)
})
I was expecting to get back the value typed into the input field element after clicking the submit button on the html.
2
Answers
Replace "your-script.js" with the path to your JavaScript file. With these corrections, clicking the submit button should now log the input value to the console without reloading the page.
You can use it .
event.preventDefault();
please add this and try.