English 中文(简体)
如果形式有效,增加提交纽芬兰语的等级
原标题:add class to submit button if form is valid

如果表格有效,则使用j Query验证纸面,验证表格的形式,想在提交纽顿时添加一个“批号”。

修正

This is the code i have at the moment all working and validating, just need a function to add the class if valid: http://jsfiddle.net/kKSjL/

Link to jQuery validation page: http://docs.jquery.com/Plugins/Validation/

最佳回答

一般来说,你需要说明,作为有效呼吁中的<编码>submitHandler:

$("#commentForm").validate({
    submitHandler:function(form){
        if (this.valid()){
          $( #submit ).addClass( next );
          form.submit();
        } 
    }  
});

http://jsfiddle.net/ryleyb/kKSjL/1/“rel=“nofollow” http://jsfiddle.net/ryleyb/kKSjL/1/。

问题回答

然而,如果你重新启动验证检查,你需要这一守则......

if ($("#commentForm").valid()) {
    $("#submit").addClass("next");
} else {
    $("#submit").removeClass("next");
}




相关问题
Bind Button.IsEnabled to custom validation with XAML?

I am sorry I didn t know how to title my question any better, you name it if you got a good 1. I have an entity Contact. this person has navigation properties: Address, Phones (A collection of Phone)....

WPF - MVVM - NHibernate Validation

Im facing a bit of an issue when trying to validate a decimal property on domain object which is bound to a textbox on the view through the viewmodel. I am using NHibernate to decorate my property on ...

Wpf Combobox Limit to List

We are using Wpf Combobox to allow the user to do the following things: 1) select items by typing in the first few characters 2) auto complete the entry by filtering the list 3) suggesting the first ...

Rails 101 | validates_currency?

I ve searched high and low, but I could not find a solution, to what I think seems like a very common task. In a form I want to have a text input that accepts currency strings (i.e. $1,000,000 or ...

CodeIgniter form verification and class

I m using the form validation library and have something like this in the view <p> <label for="NAME">Name <span class="required">*</span></label> <?...

热门标签