我正在尝试使用来自ink.sapo.pt http://ink.sapo.pt/index.php/js/ui#formvalidator的表单验证器
我想截取提交事件来编写我自己的代码,但是下面的事件总是被调用:
$("#myform").submit(function() {
alert('Handler for .submit() called.');
});即使onsubmit属性为false也是如此。
基本上,我希望ink.sapo.pt验证我的表单,但我希望每次验证表单时都使用我自己的代码。
发布于 2013-02-05 19:51:23
纯java-script
<form id="myform" class="ink-form block" method="post" action="#"
onsubmit="submitForm(this);">
function submitForm(formObj)
{
if(SAPO.Ink.FormValidator.validate(formObj))
{
//Button Action
}
}发布于 2013-02-05 19:35:05
试试这个:
$("#myform").submit(function(ev) {
ev.preventDefault();
alert('Handler for .submit() called.');
});基本上,正如您可以猜到的那样,添加的行所做的是避免指定事件上的默认行为。
https://stackoverflow.com/questions/14706578
复制相似问题