Is it safe to use anchor to submit form?

后端 未结 3 1662
时光说笑
时光说笑 2020-12-05 01:48

I\'ve read somewhere, that using anchor tag to submit a form isn\'t very safe, so that\'s my question: Is it safe, to use anchor tag instead of

3条回答
  •  萌比男神i
    2020-12-05 02:28

    To use an anchor to submit a form would require the use of JavaScript to hook up the events. It's not safe in that if a user has JavaScript disabled, you won't be able to submit the form. For example:

    Submit!

    If you'd like you can use a

    Or stick with what we all know:

    
    

    You can style all three of them, but the latter two don't require JavaScript. You probably just need to change some CSS somewhere if you're having border issues.

提交回复
热议问题