I am new to javascript and I am little bit confused about the syntax.
function validateForm()
{
var x=document.forms["myForm"]["fname"].value
if (x==null || x=="")
{
alert("First name must be filled out");
return false;
}
}
<form name="myForm" action="demo_form.asp" onsubmit="return validateForm()" method="post">
First name: <input type="text" name="fname">
<input type="submit" value="Submit">
</form>
My question is If I write onsubmit="return validateForm()" or write onsubmit="validateForm()". What's the difference between these two syntax. So I submitted before just an example.
Here it is example
Event = function(); or Event = return function();
What's the difference between these two syntax