Issue
I'm quite new at JS. I'm not exactly getting what's the difference between
<form onsubmit="return func()">
and <form onsubmit="func()">
. Both the cases are doing the same thing. What is the job of return & when do we need that?
Solution
Here is more explanation on the issue.
TL;DR: If you use return and func() returns false, the form will not be submitted. Without return, it will run the function and submit the form regardless of the return value of func().
Answered By - severhasan
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.