【问题标题】:Jquery disable form and enabledJquery禁用表单并启用
【发布时间】:2015-12-29 01:01:13
【问题描述】:

我尝试在发送表单时启用和禁用此功能但不起作用,我在这里放置了该功能:

jQuery("#c_input_submit").attr('disabled','disabled');
jQuery("#c_response").empty().append('Error');
jQuery("#c_response")
   .css({"color":"#ffffff","background":"red"})
   .show(2000)
   .delay(2500)
   .hide(2000)
   .delay(1000)
   .function(function() {
       jQuery("#c_input_submit").removeAttr('disabled');
   });

当我发送表单时,我禁用了提交按钮,但是当其他时间结束表单没有重新启用按钮时,我不知道脚本中有什么不好

通过这个我提出这个问题以获得一些帮助,谢谢和问候

【问题讨论】:

  • 你能在 jsfiddle 上发布你的完整示例吗?目前尚不清楚您想要实现什么
  • 当我发送表单时,此代码禁用提交按钮,但是当转到函数末尾时必须重新启用相同的按钮,唯一的问题是重新启用 sumit 按钮,问候跨度>

标签: jquery attr


【解决方案1】:

使用延迟功能,您可以使用回调来启用按钮

    jQuery("#c_input_submit").attr('disabled', 'disabled');
    jQuery("#c_response").empty().append('Error');
    jQuery("#c_response")
        .css({
        "color": "#ffffff",
        "background": "red"
    })
        .show(2000)
        .delay(2500)
        .hide(2000)
        .delay(1000,function () {
            jQuery("#c_input_submit").removeAttr('disabled');
    });

JsFiddle

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-10-12
    • 1970-01-01
    • 1970-01-01
    • 2017-04-15
    • 1970-01-01
    相关资源
    最近更新 更多