[英]Disable and change color of submit button in jQuery Steps
我看过类似的问题,但到目前为止没有解决方案。 我正在使用jQuery Steps表单,并且尝试禁用单击提交按钮并更改外观。 我试过使用:
$('finish').attr('disabled',true);
但这没有用。 当我单击按钮时,它不会禁用按钮或更改外观。 当我单击两次时,它将向我发送两封带有测试表格的电子邮件。
编辑:我不是要删除“输入”,而是要删除“提交”按钮,jQuery文档将其列为“完成”。
我的完整JS在下面。
$(function(){
$("#smart-form").steps({
bodyTag: "fieldset",
headerTag: "h2",
bodyTag: "fieldset",
transitionEffect: "fade",
titleTemplate: "<span class='number'>#index#</span> #title#",
labels: {
finish: "Submit Form",
next: "Continue",
previous: "Go Back",
loading: "Loading..."
},
onStepChanging: function (event, currentIndex, newIndex){
if (currentIndex > newIndex){return true; }
var form = $(this);
if (currentIndex < newIndex){}
return form.valid();
},
onStepChanged: function (event, currentIndex, priorIndex){
},
onFinishing: function (event, currentIndex){
var form = $(this);
$('finish').attr('disabled',true);
form.validate().settings.ignore = ":disabled";
return form.valid();
},
onFinished: function (event, currentIndex){
var form = $(this);
$(form).ajaxSubmit({
target:'.result',
beforeSubmit:function(){
//$('.form-footer').addClass('progress');
},
error:function(){
//$('.form-footer').removeClass('progress');
},
success:function(){
$('.alert-success').show().delay(10000).fadeOut();
//$("#wizard").steps('done');
//$("#smart-form").steps('reset');
//setCurrentIndex();
//startIndex: 0
//reset();
/*$('.form-footer').removeClass('progress');
$('.alert-success').show().delay(10000).fadeOut();
$('.field').removeClass("state-error, state-success");
if( $('.alert-error').length == 0){
$('#smart-form').resetForm();
reloadCaptcha();
}*/
}
})
}
尝试这个...
//Applying colour for finish button
var result = $('ul[aria-label=Pagination]').children().find('a');
$(result).each(function () {
if ($(this).text() == 'Finish') {
$(this).attr('disabled', true);
$(this).css('background', 'green');
}
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.