Bootstrap Modal 在其他按钮上设置时无法打开
Bootsrapmodal not opening on seting it on other button
为什么当我点击登录按钮时它没有打开登录模式,但在注册时它打开了我在两者上添加了相同的内容只是在 eto loginModel 上重命名登录但它在注册时不起作用按预期工作我正在使用 bootstrap 模式
Header.php
<button class="btn btn-success ml-2 mt-2 data-bs-toggle="modal" data-bs-target="#loginModal">login </button>
<button class="btn btn-success mx-2 mt-2" data-bs-toggle="modal" data-bs-target="#signupModal">signup </button>
</div>
</div>
</div>
</nav>';
include 'partials/_loginmodal.php';
include 'partials/_signupmodal.php';
_loginmodal.php
<!-- Button trigger modal -->
<button type="button" class="btn btn-primary" >
Launch demo modal
</button>
<!-- Modal -->
<div class="modal fade" id="loginModal" tabindex="-1" aria-labelledby="loginModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="loginModalLabel"></h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
...
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
</div>
</div>
_signupmodal.php
<!-- Button trigger modal -->
<button type="button" class="btn btn-primary" >
Launch demo modal
</button>
<!-- Modal -->
<div class="modal fade" id="signupModal" tabindex="-1" aria-labelledby="signupModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="signupModalLabel">Signup</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
...
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
</div>
</div>
这一行:
<button class="btn btn-success ml-2 mt-2 data-bs-toggle="modal" data-bs-target="#loginModal">login </button>
^
缺少双引号。应该是:
<button class="btn btn-success ml-2 mt-2" data-bs-toggle="modal" data-bs-target="#loginModal">login </button>
^
为什么当我点击登录按钮时它没有打开登录模式,但在注册时它打开了我在两者上添加了相同的内容只是在 eto loginModel 上重命名登录但它在注册时不起作用按预期工作我正在使用 bootstrap 模式
Header.php
<button class="btn btn-success ml-2 mt-2 data-bs-toggle="modal" data-bs-target="#loginModal">login </button>
<button class="btn btn-success mx-2 mt-2" data-bs-toggle="modal" data-bs-target="#signupModal">signup </button>
</div>
</div>
</div>
</nav>';
include 'partials/_loginmodal.php';
include 'partials/_signupmodal.php';
_loginmodal.php
<!-- Button trigger modal -->
<button type="button" class="btn btn-primary" >
Launch demo modal
</button>
<!-- Modal -->
<div class="modal fade" id="loginModal" tabindex="-1" aria-labelledby="loginModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="loginModalLabel"></h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
...
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
</div>
</div>
_signupmodal.php
<!-- Button trigger modal -->
<button type="button" class="btn btn-primary" >
Launch demo modal
</button>
<!-- Modal -->
<div class="modal fade" id="signupModal" tabindex="-1" aria-labelledby="signupModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="signupModalLabel">Signup</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
...
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
</div>
</div>
这一行:
<button class="btn btn-success ml-2 mt-2 data-bs-toggle="modal" data-bs-target="#loginModal">login </button>
^
缺少双引号。应该是:
<button class="btn btn-success ml-2 mt-2" data-bs-toggle="modal" data-bs-target="#loginModal">login </button>
^