Is it a good practice to use an empty URL for a HTML form's action attribute? (action=“”)

后端 未结 11 2202
花落未央
花落未央 2020-11-22 01:50

I am wondering if anyone can give a \"best practices\" response to using blank HTML form actions to post back to the current page.

There is a post asking what a blan

11条回答
  •  别那么骄傲
    2020-11-22 02:28

    IN HTML 5 action="" IS NOT SUPPORTED SO DON'T DO THIS. BAD PRACTICE.

    If instead you completely negate action altogether it will submit to the same page by default, I believe this is the best practice:

    This will submit to the current page

    If you are sumbitting the form using php you may want to consider the following. read more about it here.

    ">

    Alternatively you could use # bear in mind though that this will act like an anchor and scroll to the top of the page.

    
    

提交回复
热议问题