Materialise bootstrap 未被触发
Materialize bootstrap not being triggered
我有这段代码,当用户成功添加新用户时,它会触发一个模式。我已经使用了物化并且没有触发模态。这是我的部分代码:
<div id="thisismymodal" class="modal">
<div class="modal-content">
<h4>Modal Header</h4>
<p>A bunch of text</p>
</div>
<div class="modal-footer">
<a href="#!" class=" modal-action modal-close waves-effect waves-green btn-flat">Agree</a>
</div>
</div>
@if( Session::has('uadded') )
{{ Session::forget('uadded') }}
<script>
alert("well hello there!");
$(document).ready(function()
{
$('#thisismymodal').leanModal();
$('#thisismymodal').openModal();
});
</script>
@endif
只有警报被触发而不是模态。关于我的代码做错了什么有什么想法吗?
要通过某些事件打开模式,您不需要 $('#thisismymodal').leanmodal() 因为它仅用于在单击按钮时触发。如我所见,您的模式应该以编程方式启动,因此只需要 $('#thisismymodal').openModal(); 。
我假设您正在使用 php 将用户添加到数据库。您是否有 'if' 条件来检查数据是否已成功写入数据库?
如果数据写入成功,您可以在 'if' 语句中启动脚本。
我有这段代码,当用户成功添加新用户时,它会触发一个模式。我已经使用了物化并且没有触发模态。这是我的部分代码:
<div id="thisismymodal" class="modal">
<div class="modal-content">
<h4>Modal Header</h4>
<p>A bunch of text</p>
</div>
<div class="modal-footer">
<a href="#!" class=" modal-action modal-close waves-effect waves-green btn-flat">Agree</a>
</div>
</div>
@if( Session::has('uadded') )
{{ Session::forget('uadded') }}
<script>
alert("well hello there!");
$(document).ready(function()
{
$('#thisismymodal').leanModal();
$('#thisismymodal').openModal();
});
</script>
@endif
只有警报被触发而不是模态。关于我的代码做错了什么有什么想法吗?
要通过某些事件打开模式,您不需要 $('#thisismymodal').leanmodal() 因为它仅用于在单击按钮时触发。如我所见,您的模式应该以编程方式启动,因此只需要 $('#thisismymodal').openModal(); 。
我假设您正在使用 php 将用户添加到数据库。您是否有 'if' 条件来检查数据是否已成功写入数据库?
如果数据写入成功,您可以在 'if' 语句中启动脚本。