Updated on Kisan Patel
In the above code, we have a password textbox and a button in the html form. In the Form we have written
onsubmit event that executes when the form submitted to the server. On the
onsubmit event we are executing
TestFunction() function, we are checking for the textbox value, if it is “password” then we are returning true otherwise false. As in the
onsubmit event we have written
return TestFunction() so in case this function returns true and the form is submitted to the server otherwise it is not.