【发布时间】:2012-11-29 10:33:03
【问题描述】:
我想知道如何获取formmethod、formaction、formenctype 或formtarget,当在<input type="submit"> 表单内设置时,在submit 事件上。
<form action="/url" method="POST">
...
<input type="submit" value="Action 1" formaction="/another-url">
<input type="submit" value="Action 2" formmethod="PUT">
</form>
$(function(){
$('form').bind('submit', function(){
// how to get it here?
// need to know if action1 or action2 was clicked, and if any of them have "form*" attributes
return false;
});
});
这里有解释http://www.adobe.com/devnet/dreamweaver/articles/html5-forms-pt2.html#articlecontentAdobe_text_31
由于我正在创建一个 jQuery 插件,我不知道它会在哪里使用,所以它必须是一个万能的解决方案。看来jQuery还不能处理它来提供一个安全的跨浏览器解决方案。
谢谢
【问题讨论】:
-
更新了我的问题,不是重复的
标签: javascript jquery forms html events