gpt4 book ai didi

javascript - Materialise Bootstrap 未被触发

转载 作者:行者123 更新时间:2023-11-28 05:45:54 28 4
gpt4 key购买 nike

我有这段代码,当用户成功添加新用户时,它会触发一个模式。我已经使用了物化并且没有触发模态。这是我的部分代码:

<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”语句中启动脚本。

关于javascript - Materialise Bootstrap 未被触发,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37609668/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com