你如何强制使用 php 打开 Jquery Mobile 弹出窗口
How do you force a Jquery Mobile popup to open using php?
基本上,我试图强制我的一个Jquery移动弹出窗口在触发isset($_POST["submit"])
时打开。
加载弹出窗口将不起作用,必须在提交表单时激活它。
例如:
<?php
if(isset($_POST['submit']))
{
//other stuff
//force open popup
}
?>
<form method='post' action='self.php'>
<input type='submit' name='submit' value='submit' />
</form>
<a href="#popup" data-rel="popup" data-position-to="window" data-role="button" data-inline="true" data-icon="check" data-theme="a" data-transition="pop">popup</a>
<div data-role="popup" id="popupLogin" data-theme="a" class="ui-corner-all">
<!-- Popup contents -->
</div>
你能试试这个吗?
<script type="text/javascript">
$('#form').on('submit', function () {
$("#popupLogin").popup("open")
});
</script>
致奥马尔感谢您纠正我:)
您不能只是回显某些内容以使弹出窗口出现,或者如果是正常打开它的a
,您可以模拟单击它......
<?php
if(isset($_POST['submit']))
{
//other stuff
?>
<script type="text/javascript">
$("document").ready(function(){
// Simulate a click on a. I'd recommend giving A an ID or class to get it.
$("a[href=#popup]").click();
});
</script>
<?php
}
?>
Add id to anchor tag and use its click event when posted. Code below:
<form method='post' action='self.php'>
<input type='submit' name='submit' value='submit' />
</form>
<a id="popUp" href="#popup" data-rel="popup" data-position-to="window" data-role="button" data-inline="true" data-icon="check" data-theme="a"
<div data-role="popup" id="popupLogin" data-theme="a" class="ui-corner-all">
<!-- Popup contents -->
</div>
<?php
if(isset($_POST['submit']))
{
//other stuff
//force open popup
echo "<script>";
echo "$('#popUp').click();"
echo "</script>";
}
?>
相关文章:
- 无法从jquery Mobile导航栏重定向到另一个页面
- jquery mobile上多个页面上的一个表单
- window.location使用jquery mobile实现chrome跳转
- 防止jQuery Mobile中的ajax缓存
- 如何在JQUERY Mobile上放置谷歌地图
- JQuery Mobile Javascript复杂方程式
- jQuery Mobile Undefined不是一个函数
- jQuery mobile not going through ID
- 如何使用javascript或jquery mobile从url读取和显示XML文件
- jQuery Mobile Collapse上的AJAX请求
- 应用程序在呈现Jquery Mobile之前显示无样式的Html
- 如何在jQuery Mobile 1.4 Datepicker中创建事件
- UIWebview赢得't通过基本身份验证加载动态加载的资源(通过jQuery mobile)
- jQuery Mobile到其他页面的锚链接不起作用
- 如何在jQuery Mobile中设置100%宽度的输入类型日期
- JQuery Mobile破坏了我的布局:如何禁用自动打字
- 防止用户在jQuery Mobile中ajax加载页面时单击其他位置
- 根据手机上是否存在文件,在jQuery mobile中动态填充列表视图
- Image Sprites和jQuery Mobile Ajax导航的问题
- Mixing JQuery Mobile & JQuery UI