With form validation: why onsubmit=“return functionname()” instead of onsubmit=“functionname()”?

后端 未结 6 2158

The question is pretty self-explanatory. I don\'t understand what the return is doing in the following code:

6条回答
  •  悲&欢浪女
    2020-12-02 13:39

    An extension to what GenericTypeTea says - Here is a concrete example:

    
    

    The above form will not submit, whereas...

    
    

    ...does nothing, i.e. the form will submit.

    Without the return, onsubmit doesn't receive a value and the event is executed just like without any handler at all.

提交回复
热议问题