禁用表单自动提交按钮单击 [英] Disable form auto submit on button click

查看:41
本文介绍了禁用表单自动提交按钮单击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 HTML 表单,其中使用了多个按钮.问题是无论我点击哪个按钮,即使按钮不是提交"类型,表单也会被提交.例如像这样的按钮:,导致表单提交.

I have a HTML form where I use several buttons. The problem is that no matter which button I click, the form will get submitted even if the button is not of type "submit". e.g. Buttons like :<button>Click to do something</button>, result in form submission.

为这些按钮中的每一个都执行一个 e.preventDefault() 非常痛苦.

It's quite painful to do an e.preventDefault() for each one of these buttons.

我使用 jQuery 和 jQuery UI,网站是 HTML5.

I use jQuery and jQuery UI and the website is in HTML5.

有没有办法禁用这种自动行为?

Is there a way to disable this automatic behavior?

推荐答案

按钮,如

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆