return validate - JavaScript | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

return validate - JavaScript

<form onsubmit="return validate()" method="post"> Number: <input type="text" name="num1" id="num1" /> <br /> Repeat: <input type="text" name="num2" id="num2" /> <br /> <input type="submit" value="Submit" /> </form> Why are we using "return" here and why not just "validate()"?

25th Aug 2020, 5:42 PM
Bishwajit Khanra
Bishwajit Khanra - avatar
1 Answer
+ 1
You apply for a job in a company You submit your details to the company The company receives and do the certain validation and THEN RETURN YOU WHETHER You ARE SELECTED OR NOT (in this case validate())
25th Aug 2020, 5:46 PM
Rohit