引导框确认-当选择OK时包含href
bootbox confirm - include href when OK is selected
我试图在bootbox.js添加到测试页面。
目前,当我在触发引导框的超链接中包含href标签时,无论我点击什么确认按钮(取消或确定),都会触发href。
我如何将href标签包含到bootbox js代码中,只有当用户选择OK确认选项时才会触发?我试了几次,但都没有用。
下面是带有href标签的超链接:
<a id="id_customized_details_duplicate" href="{% url customized_details_duplicate customized_detail.id %}">Duplicate</a>
这是我的bookbox js代码:
$(document).ready(function(){
$('#id_customized_details_duplicate').on('click', function(){
bootbox.confirm("Are you sure?", function(result) {
if (result) {
//include the href duplication link here?;
//showProgressAnimation();
alert('OK SELECTED');
} else {
alert('CANCEL SELECTED');
}
});
});
});
尝试这样做,防止anchor tag
&在bootbox
确认处理程序中添加具有相应href
位置的窗口重定向调用(当单击"OK"选项时)。
$(document).ready(function(){
$('#id_customized_details_duplicate').on('click', function(event){
event.preventDefault();
bootbox.confirm("Are you sure?", function(result) {
if (result) {
//include the href duplication link here?;
window.location = $(this).attr("href");
//showProgressAnimation();
alert('OK SELECTED');
} else {
alert('CANCEL SELECTED');
}
});
});
});
现场演示:http://jsfiddle.net/dreamweiver/9he30z4y/255/
Happy Coding:)
相关文章:
- 当包含另一个asp文件时,是否也包含所有引用的样式和脚本页面
- 货币代码为欧元-金额的格式不应包含小数
- 如何包含特定于每个视图angularjs的javascript文件
- 我如何修复包含在captcha的addthis中的错误
- 正在注入包含JS的HTML
- Json数据包含日期和时间格式
- Angular js-返回一个包含类似
- jQuery/JS包含运算符或类似运算符
- 如果href包含X,请更改href
- JavaScript数组包含一个值
- 带有填充属性的SVG矩形显示在包含元素的上方插入框阴影
- 在Meteor项目中安装并包含npm模块后出错
- 传递包含'%的参数'在URL中
- 对一个对象使用reduce可以返回一个没有't在数组中包含目标字母
- 如何首先设置样式<td>表中包含在窗体中的元素
- 每天用javascript包含不同的php文件
- 数据绑定:'系统Char'不包含名为'xxxxx'
- 使用Javascript生成包含JSP的HTML
- 电话间隙3包含一个报警框;OK”;浏览器崩溃
- 引导框确认-当选择OK时包含href