【发布时间】:2019-11-24 00:35:49
【问题描述】:
我正在使用 bootstrap 中的 modal。模式打开,但没有使用十字或关闭按钮关闭。
这是我的 index.php 文件中的内容:
<div id="editar" class="modal fade" role="dialog" tabindex="-1" aria-hidden="true">
</div>
这是一个单独的 .php 文件中的模式:
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Editar Accion</h4>
<button type="button" class="close" data-dismiss="modal" id="cerrar">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<input type="hidden" name="editar" value="<?php echo $id; ?>">
<div class="form-group">
<label for="item_name">Accion:</label>
<input type="text" class="form-control" id="accion" value="<?php echo $accion; ?>">
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary mb-3" name="update" id="btn-editar"><span class="glyphicon glyphicon-edit"></span> Editar</button>
<button type="button" class="btn btn-secondary mb-3" data-dismiss="modal"><span class="glyphicon glyphicon-remove-circle"></span> Cancelar</button>
</div>
</div>
</div>
我必须将它们保存在两个文件中。
【问题讨论】:
-
您好,有几个问题。 (1)当它们在同一个文件中时它是否正常工作? (2) 你确定你在第一个模态 div 中包含 include 或 require 的模态。 (3) 模态打开正常但不关闭?您能否包括调用模态的位。
-
是的,我在同一个文件中有另一个模式并且它可以工作,但是这个特别是我必须将它保存在 2 个文件中 php.ini 文件。模态打开但不关闭,“取消”按钮也不起作用,接下来我有另一个按钮是保存版本,它工作得很好
-
我有一个问题,模态的包含或要求是什么?
-
我试过你的代码添加一个按钮来调用模式并将模式放在一个单独的 php 文件中并且它可以工作,所以你在这里发布的代码不是问题。 include 或 require 我的意思是你如何将模式添加到 index.php 中,因为你说你有它在两个单独的文件中?您必须在
<div id="editar"></div>中执行类似include "editar_modal.php"的操作。我认为最好发布整个代码(两个文件),这样我就可以自己尝试一下,看看哪里出了问题。 -
很难将第二页的模态引用到第一页。最好在一个页面中调用这两种方法,然后在按钮上单击显示模式弹出窗口。
标签: php html css bootstrap-4