I have create an eshop.
I have enter an input field for ‘quantity’ and When i click on a submit button the products will be added in my basket. But if i press the submit button with empty the quantity field it will redirect me to an empty page.
So I want to attach an event to the form submission so that nothing is done if the quantity field is empty.
New in javascript, Thanks in advance!
This will capture the submit action of your form and verify that a given field is not empty. Returning false interrupts the form submission. This can also be done by passing an event parameter to the function and then using
e.preventDefault().