0

具有以下对话框定义:

<div data-role="dialog" id="operator-delete" data-theme="b" data-title="Delete record">

    <div data-role="header" data-theme="b">
        <h2>Confirm deletion</h2>
    </div>

    <div data-role="content">
        <p><div id="delete-confirm">Do you really want to delete record?</div></p> 
        <table border="0" cellspacing="30" width=100%>
            <tr>
                <td valign="center" halign="left"><a href="#" id="delete-cancel" data-role="button" data-inline="true" data-theme="b" data-rel="back" data-icon="arrow-l">No</a></td>
                <td valign="center" halign="right"><a href="#" id="delete-confirm" data-role="button" data-inline="true" data-theme="b" data-icon="delete">Yes</a></td>
            </tr>
        </table>
    </div> <!-- /content -->
</div> <!-- /dialog -->

此对话框由 jQuery 按钮调用:

<a href="#operator-delete" data-rel="dialog" data-transition="pop" 
id="delete-user" data-role="button" data-inline="true" data-theme="b" data-icon="delete" class="ui-btn-right">Delete</a>

对话框按要求出现,但对对话框标题中的“否”按钮和关闭按钮没有反应。同时jQuery doc说:“当在对话框中单击任何链接时,框架将自动关闭(!!!)对话框......”。我看到了 jQuery 示例源——他们没有付出额外的努力来关闭示例对话框。怎么了?

4

1 回答 1

1

我实现了您的代码,但是关闭对话框没有任何问题。请检查小提琴。我觉得你的 HTML 结构有问题。

<div data-role="page">
    <div data-role="content">
            <a href="#operator-delete" data-rel="dialog" data-transition="pop" 
id="delete-user" data-role="button" data-inline="true" data-theme="b" data-icon="delete" class="ui-btn-right">Delete</a>
    </div>
</div>

<div data-role="dialog" id="operator-delete" data-theme="b" data-title="Delete record">
    <div data-role="header" data-theme="b">
         <h2>Confirm deletion</h2>

    </div>
    <div data-role="content">
        <p>
            <div id="delete-confirm">Do you really want to delete record?</div>
        </p>
        <table border="0" cellspacing="30" width=100%>
            <tr>
                <td valign="center" halign="left"><a href="#" id="delete-cancel" data-role="button" data-inline="true" data-theme="b" data-rel="back" data-icon="arrow-l">No</a>
                </td>
                <td valign="center" halign="right"><a href="#" id="delete-confirm" data-role="button" data-inline="true" data-theme="b" data-icon="delete">Yes</a>
                </td>
            </tr>
        </table>
    </div>
    <!-- /content -->
</div>
<!-- /dialog -->

http://jsfiddle.net/maheshsapkal/aeWAE/

于 2013-04-18T15:36:15.677 回答