jquery 简单确认对话框
任何人都知道如何在我单击单选按钮时出现确认对话框。
从http://projectshadowlight.org/jquery-easy-confirm-dialog/。只是有点困惑去调整它。
下面的代码将在单击单选按钮之前触发确认对话框!如果我使用默认的 Windows 对话框,它工作正常(单击无线电然后弹出)?请任何解决方案!
**HTML:**
<input class="8" id="block_t" name="t_products" onclick="goingnow(this)" type="radio" value="Block x10 (3mins)" rel="3">Block x10 (3mins)
<input class="9" id="block_t" name="t_products" onclick="goingnow(this)" type="radio" value="Block x10 (3mins)" rel="4">Block x10 (6mins)
**javaScript function:**
function goingnow(_this){
if ($("#going_now").attr("value") == 1) {
$("#going_now").attr("value", 0);
} else {
if ($(_this).is(":checked") == true) {
var conf = $(_this).is(":checked").easyconfirm({locale: { title: 'Select Yes or No', button: ['No','Yes']}});
if (conf){
$("#going_now").attr("value",1);
$("#block_mins").attr("value", $(_this).attr("rel"));
} else {
$("#block_mins").attr("value", $(_this).attr("rel"));
}
}
}
}
Anyone know how to make the confirmation dialog appear when i click on the radio buttons.
Downloaded the code from http://projectshadowlight.org/jquery-easy-confirm-dialog/. just bit confused to tweak it.
Below code will trigger the confirmation dialogue before radio button is clicked! if i use the default windows dialogue, it works fine (radio is clicked then pop up)? any solution please!
**HTML:**
<input class="8" id="block_t" name="t_products" onclick="goingnow(this)" type="radio" value="Block x10 (3mins)" rel="3">Block x10 (3mins)
<input class="9" id="block_t" name="t_products" onclick="goingnow(this)" type="radio" value="Block x10 (3mins)" rel="4">Block x10 (6mins)
**javaScript function:**
function goingnow(_this){
if ($("#going_now").attr("value") == 1) {
$("#going_now").attr("value", 0);
} else {
if ($(_this).is(":checked") == true) {
var conf = $(_this).is(":checked").easyconfirm({locale: { title: 'Select Yes or No', button: ['No','Yes']}});
if (conf){
$("#going_now").attr("value",1);
$("#block_mins").attr("value", $(_this).attr("rel"));
} else {
$("#block_mins").attr("value", $(_this).attr("rel"));
}
}
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用 jQuery Ui 对话框设置单击单选按钮时的确认。您不需要为此使用任何插件。
检查工作示例 http://jsfiddle.net/jZ52e/2/
You can use jQuery Ui dialog to set a confirmation when radio is clicked on. You don't need to use any plugin for this.
Check working example at http://jsfiddle.net/jZ52e/2/
我制作了一个适合您需求的插件。甚至更多。
我见过开发人员遇到问题,这个插件解决了所有问题,
支持:Ajax 内容加载、以内容更改为中心的动态屏幕、自动关闭对话框(在计时器上运行)、具有许多功能的强大功能。
并且易于使用!
工作示例和完整功能列表http://craftpip.github.io/jquery-confirm/
i have made a plugin that suites your needs. and even more.
I have seen developers facing problems, and this plugin has solved all problems,
Supports: Ajax content loading, Dynamic screen centering on content change, Auto closing of dialogs (runs on timer), Powerpacked with many features.
and its easy to use !
Working example and full list of features http://craftpip.github.io/jquery-confirm/