代码之家  ›  专栏  ›  技术社区  ›  john Gu

提交模式弹出窗口时无法禁用.btn默认值

  •  0
  • john Gu  · 技术社区  · 11 年前

    我正在使用asp.net vmc5,我正在使用bootstrap 3.0&jQuery1.10.2,现在我编写了以下脚本:

    function bindForm(dialog) {
        $('form', dialog).submit(function () {
            $('.btn btn-default').prop("disabled", "disabled");
            $('#progress').show();
            if ($(this).valid()) {
    
                $.ajax({
                    url: this.action,
                    type: this.method,
                    data: $(this).serialize(),
    

    我提交的模态弹出窗口如下所示:-

     <div class="form-group">
                <div class="col-md-offset-2 col-md-10">
                    <input type="submit" value="Save" class="btn btn-default" /> |  @Html.ActionLink("Back to List", "Index")
                </div>
            </div>
        </div>
    }
    <span id="progress" class="text-center" style="display: none;">
                    <img src="~/img/ajax-loaders/ajax-loader-5.gif" alt="wait" />
                    Wait..
                </span>
    

    但是现在,当我提交表单时,将显示进度图像(如脚本中所述),但提交按钮不会被禁用?有人能帮忙吗? 谢谢

    1 回复  |  直到 11 年前
        1
  •  6
  •   Umesh Sehta    11 年前

    您的选择器无效,请尝试以下操作:-

     $('.btn.btn-default').prop("disabled", "disabled");