[英]I can't open modal from php
I have a code by using Materializecss and PHP. 我通过使用Materializecss和PHP编写了代码。 I want to open some modal by returning Php code.
我想通过返回PHP代码打开一些模式。 For example code is 4 is equal wrong password etc.
例如代码是4等于错误的密码等。
But I never satisfied to show modal even try several suggestions shown on this site. 但是我从不满意展示模式,甚至尝试过本网站上显示的一些建议。
Can you help me? 你能帮助我吗?
Here is part of my code : 这是我的代码的一部分:
<?php
....
else {
echo "<script>$('#modalWrongPassword').fadeIn('show');</script>";
}
}
?>
...
<div id="modalWrongPassword" class="modal">
<div class="modal-content">
<h4>Hatalı şifre</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">Kapat</a>
</div>
</div>
...
<script type="text/javascript" src="../js/jquery-2.1.1.min.js"></script>
<script type="text/javascript" src="../js/materialize.min.js"></script>
<script src="../js/jquery-2.js"></script>
<script>if (!window.jQuery) { document.write('<script src="bin/jquery-2.1.1.min.js"><\/script>'); }</script>
<script src="../js/jquery.js"></script>
<script src="../js/prism.js"></script>
<script src="../js/lunr.js"></script>
<script src="../js/materialize1.js"></script>
<script src="../js/init1.js"></script>
...
With Materializecss, can't open a modal like the way you are trying 使用Materializecss,无法像您尝试的方式一样打开模式
echo "<script>$('#modalWrongPassword').fadeIn('show');</script>";
Here is the reference how to show Materializecss Modal programatically, via JavaScript 这是如何通过JavaScript以编程方式显示Materializecss Modal的参考
echo "<script>$('#modalWrongPassword').openModal();</script>";
Note: Make sure you include jQuery and other JS libraries only one time, eg you have included jQuery and Materialize JS multiple times in document. 注意:确保仅一次包含jQuery和其他JS库,例如,在文档中多次包含jQuery和Materialize JS。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.