保持开放的模态需要在保存后关闭

时间:2014-12-23 20:39:04

标签: javascript twitter-bootstrap

点击保存更改后保存需要关闭的模态保持打开

                                                                     ×关闭                     目录申请表                                                                                                                                                名字                                                                                                                                                                            姓                                                                                                                                                                            电邮*                                                                                                                                                                            电话                                                                                                                                                                            地址                                                                                                                    

                      <div class="form-group">
                        <label for="inputEmail3" class="col-sm-3 control-label">City</label>
                        <div class="col-sm-9">
                          <input type="text" class="form-control cr_city" id="inputEmail3" placeholder="City">
                        </div>
                      </div>
                      <div class="form-group">
                        <label for="inputEmail3" class="col-sm-3 control-label">State</label>
                        <div class="col-sm-9">
                          <input type="text" class="form-control cr_state" id="inputEmail3" placeholder="State">
                        </div>
                      </div>
                      <div class="form-group">
                        <label for="inputEmail3" class="col-sm-3 control-label">Zip Code</label>
                        <div class="col-sm-9">
                          <input type="text" class="form-control cr_zipcode" id="inputEmail3" placeholder="Zip Cope">
                        </div>
                      </div>

                      <div class="form-group">
                        <label for="inputEmail3" class="col-sm-3 control-label">Truck Make (Peterbilt, Kenworth, Etc.)</label>
                        <div class="col-sm-9">
                          <input type="text" class="form-control cr_truck" id="inputEmail3" placeholder="Truck Make (Peterbilt, Kenworth, Etc.)">
                        </div>
                      </div>

                    </form>
              </div>
              <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                <button type="button" class="btn btn-default cr_clear">Clear</button>
                <button type="button" class="btn btn-primary cr_submit">Save changes</button>
              </div>
            </div>
      </div>

1 个答案:

答案 0 :(得分:0)

您需要在JavaScript中的按钮点击处理程序的末尾调用$('#YourModalID').modal('hide')$('#YourModalID').modal('toggle')

See the documentation关于Bootstrap模态方法和事件,以获取有关如何有效使用模态的更多详细信息。