I have the following form generated dynamically from JavaScript based on user's action:
<form id="editBookForm" onsubmit="editBookData()">
<input type="text" name="isbn" placeholder="ISBN" required />
<input type="text" name="book" placeholder="Book..." required />
<button class ="btn">Update!</button>
</form>
The editBookData function is:
function editBookData(data) {
console.log(data)
//Some other work
}
How can I prevent default submission behavior and pass the form data so that I can access the form data in the editBookData() function?
No Jquery please! Thank you in Advance.
eventas a parameter to your function and call.preventDefault()on it?