Now sometimes situation arises when user wants to perform certain activities before form submission. Our form validation script in this case simply checks that a value has been entered in each of the two form fields. Our J a vaScript, like our HTML, also consists of three parts:. version added: 1.0 event.preventDefault() A fileUpload function to trigger the click event on the file upload input. We can use it to dynamically create and send our own forms to server. preventDefault in Practice. It just prevent the default browser behaviour. Now from Form Submission we know, that the user information flow from client level to server level as soon as we click submit button after which the information is further processed. event.preventDefault() Returns: undefined Description: If this method is called, the default action of the event will not be triggered. A button is called disabled if it can’t be selected, clicked on, or accept focus. In real life, you’ll probably resort to using preventDefault most often to stop forms from automatically submitting when the submit button is clicked, giving you a chance to instead submit the form data asynchronously using JavaScript and something like the …