I get this error! [ 'return' statement outside of function ]

后端 未结 4 999
北荒
北荒 2020-12-31 16:28

I was creating a form validator for a client and ran into this weird error only in Internet Explorer (Explorer) 7/8....

\'return\' outside of fu

4条回答
  •  一向
    一向 (楼主)
    2020-12-31 17:22

    The problem was that I was using a return statement to override the default behavior for my form and it was assigned to a property, but it was not placed inside an anonymous function!

    I had a form element that was set up like this:

    All I needed to change was the action property to this:

    … action="javascript:function(){return false};"
    

    It now works flawlessly!

提交回复
热议问题