In most cases, returning false for the event handler prevents the default event behavior.
For example, by default, clicking an element will jump to the page specified by the href attribute of the element. Return False is equivalent to the terminator, and Return True is equivalent to the executor. The function of return false in js is generally used to cancel the default action. For example, when you click a link, in addition to triggering your onclick event (if you specify it), you also trigger a default event, which is to execute a page jump. So if you want to cancel the default action of the object, you can return false.
Similarly, return false can be applied to form submission. For example, when we usually verify the form, we need to judge whether the information is true on the client side and whether the information is missing. If any of the above conditions are met, then we If necessary, the prompt information is output on the client and will not be submitted to the server for processing. Return flase can show its talents here - -!
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn