I have written a form validation using JS which ends with return(true);
function check() {
....validation code
return(true);
}
All I want i
You just need to modify your first code snippet. return
is a keyword, what you are trying to do is to execute it as a function.
function check() {
....validation code
return true;
}
You'll need to change your 2nd snippet slightly, to execute the function too however... The simplest way is to wrap it as an anonymous function using curly braces:
if(check()) {
(function() {
//Another function code
})();
}