This article mainly describes the use of return false in JavaScript, in most cases, returns false for the event handler function to prevent the default event behavior, and the friends you need can refer to the
In most cases, return false for the event handler to prevent the default event behavior.
For example, by clicking an element by default, the page jumps to the page specified by the href attribute of the element. Return False is the equivalent of a terminator, and return True is the equivalent of an operator. The function of return false in JS is generally used to cancel the default action. For example, you click a link to trigger a default event in addition to triggering your onclick event (if you specify) to perform a page jump. So if you want to cancel the default action on the object, you can return false.
Similarly, return false can be applied to the submission of a form. For example, we usually in the validation form, to the client to determine whether the information is true, whether the leakage of information, if the above conditions are met, then we need, in the client output prompt information, and will not be submitted to the server processing, Return flase just to be able to work here--!