JQuery Mobile删除确认对话框

时间:2014-01-25 22:23:14

标签: jquery jquery-mobile jquery-mobile-popup

我是jquery的新手,并且真的很难设置删除某些项目的确认对话框。我能够查看弹出窗口但是当我在弹出窗口中单击DELETE时它不重定向或加载新页面但保持在同一页面上。我使用的是Jquery mobile 1.3.2版本。

解决此问题的任何帮助都会非常有帮助。以下是我正在使用的示例代码。

<body> 

<div data-role="page" class="type-interior">

<?php include "files/header2.php";?>    

<div data-role="content" data-theme="d" >
    <div class="content-primary">


        <h2><img src="images/insert_table.gif" alt="">Confirmation </h2>

            <a href="#popupDialog" data-rel="popup" data-position-to="window" data-role="button" data-transition="pop" data-icon="delete" data-theme="b" data-mini="true">Delete</a>
            <div data-role="popup" id="popupDialog" data-overlay-theme="b" data-theme="d" data-dismissible="false" style="max-width:400px;" class="ui-corner-all">
                <div data-role="header" data-theme="a" class="ui-corner-top">
                    <h1>Delete Item ?</h1>
                </div>
                <div data-role="content" data-theme="d" class="ui-corner-bottom ui-content">
                    <h3 class="ui-title">Are you sure you want to delete this Item ?</h3>
                    <p>This action cannot be undone.</p>
                    <a href="#" data-role="button" data-inline="true" data-rel="back" data-theme="c">Cancel</a>
                    <a href="del_confirm.php" data-role="button" data-inline="true" data-rel="back" data-transition="flow" data-theme="b" rel="external">Delete</a>
                </div>
            </div>

</div><!--/content-primary -->      

1 个答案:

答案 0 :(得分:0)

首先,关闭弹出窗口调用此代码

$("#popupDialog").popup("close");

然后使用此代码更改页面

$.mobile.changePage('#id', { transition: "slide"}); //id means your redirection page id

最后使用jquery remove()功能

删除项目
$("#id").remove();

如果您重定向空白页面意味着使用jquery mobile 对话

快乐的编码......