本文介绍了如何构建一个jQuery对话框进行确认(是/否),可以在应用程序的任何地方使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我有以下内容:<ol id="listItems> <li id="listItem-1"> <span class="title">Item 1</span> <span class="delete">delete</span> </li> <li id="listItem-2"> <span class="title">Item 2</span> <span class="delete">delete</span> </li> <li id="listItem-3"> <span class="title">Item 3</span> <span class="delete">delete</span> </li> <li id="listItem-4"> <span class="title">Item 4</span> <span class="delete">delete</span> </li></ol>我想在这里做的是随时点击.delete,我想要显示一个jQuery ui对话框进行确认,是或否....如果用户说是,则继续删除te点击今天它将被删除的位置。What I want to do here is anytime .delete is clicked, I want to show a jQuery ui-dialog for confirmation, Yes or No.... If the user says yes then continue with the delete click where it will be deleted as is today.如何构建一个静态的jQuery UI对话框,可以用于任意数量的列表项?更好,但我的应用程序中的任何东西都可以工作,所以它不仅仅是列表特定的。How can I build a jQuery UI Dialog that is static and would work for any number of list items? Better yet would work for anything in my app so it's not just list specific.想法?谢谢推荐答案使用JQuery UI对话框的示例 - Example using JQuery UI dialog - 演示 - http://jsfiddle.net/CdwB9/3/ function yesnodialog(button1, button2, element){ var btns = {}; btns[button1] = function(){ element.parents('li').hide(); $(this).dialog("close"); }; btns[button2] = function(){ // Do nothing $(this).dialog("close"); }; $("<div></div>").dialog({ autoOpen: true, title: 'Condition', modal:true, buttons:btns });}$('.delete').click(function(){ yesnodialog('Yes', 'No', $(this));})带电 - 演示 - http://jsfiddle.net/CdwB9/4/ $('.delete').live('click', function(){ yesnodialog('Yes', 'No', $(this));}) 这篇关于如何构建一个jQuery对话框进行确认(是/否),可以在应用程序的任何地方使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 10-29 20:19