阻止默认值后重新启用提交 [英] Re-enabling Submit after prevent default
问题描述
我正试图解除绑定或重新启用默认的阻止默认设置,以便我的表单能够根据良好的数据进行提交.
I am trying to unbind or reenable the prevent default so my form will submit on good data.
我尝试了多个示例.这是我的代码和我尝试过的一些示例.
I have tried multiple examples. Here is my code and some of the examples i tried.
此代码非常适合我想要的.只是最后一件事,并重置获得此权限后可以实现的div.
This code works great for what i want to. Just the last thing and resetting the div which i can implement after i get this.
function lengthRestriction(elem, min, max) {
var uInput = elem.value;
if (uInput.length >= min && uInput.length <= max) {
return true;
} else {
var cnt = document.getElementById('field');
cnt.innerHTML = "Please enter between " + min + " and " + max + " characters";
elem.focus();
$('#ShoutTweet').submit(function(e) {
e.preventDefault();
//bind('#ShoutTweet').submit();
//$('#ShoutTweet').trigger('submit');
});
}
}
我也设置了jsbin http://jsbin.com/ebedab/93 >
i have a jsbin set up too http://jsbin.com/ebedab/93
推荐答案
我不确定您要问什么,但是如果您的目标是销毁自定义的submit
处理程序,请使用此方法:
I'm not completely sure what you are asking, but if your goal is to destroy your custom submit
handler, then use this:
$("#ShoutTweet").unbind("submit");
这假设您具有普通(非Ajax)格式.
This assumes that you have a normal (not Ajax) form.
这篇关于阻止默认值后重新启用提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!