引导程序3:删除确认对话框无效
Bootstrap 3: delete confirm dialog box not work
我找到了删除确认对话框的bootstrap
函数:
JS:
$(document).ready(function() {
$('a[data-confirm]').click(function(ev) {
var href = $(this).attr('href');
if (!$('#dataConfirmModal').length) {
$('body').append('<div id="dataConfirmModal" class="modal" role="dialog" aria-labelledby="dataConfirmLabel" aria-hidden="true"><div class="modal-header"><button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button><h3 id="dataConfirmLabel">Please Confirm</h3></div><div class="modal-body"></div><div class="modal-footer"><button class="btn" data-dismiss="modal" aria-hidden="true">Cancel</button><a class="btn btn-primary" id="dataConfirmOK">OK</a></div></div>');
}
$('#dataConfirmModal').find('.modal-body').text($(this).attr('data-confirm'));
$('#dataConfirmOK').attr('href', href);
$('#dataConfirmModal').modal({show:true});
return false;
});
});
HTML:
<a href="delete.cfm" data-confirm="Are you sure you want to delete?">Delete</a>
这起到了作用,但css/JS
样式未在bootstrap +3
中显示对话框。我该怎么解决这个问题?
演示
模式模板在bootstrap+3中发生了更改,您需要在打开模式时更改附加到主体的HTML代码。看见http://getbootstrap.com/javascript/#modals,新模板为:
<div class="modal fade">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title">Modal title</h4>
</div>
<div class="modal-body">
<p>One fine body…</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
顺便说一句,有几个非常酷的javascript/boostrap插件可以做你想做的事情http://bootboxjs.com/,http://nakupanda.github.io/bootstrap3-dialog/.
相关文章:
- 着色引导框对话框
- 文本框不是从Javascript/Asp.net中的对话框中打印出来的
- CKeditor:更改对话框中的默认选择选项
- 搜索api在mac上显示对话框
- 使用密码对话框Javascript请求帮助
- CKEditor v4:自制插件中对话框的动态标题
- 删除确认对话框在第一次单击时不起作用
- 使用jquery对话框中的箭头键
- 获取打开jquery对话框的button的id
- 是否可以用JavaScript显示等效的文件夹对话框
- 我怎么能让jQuery对话框表现得像Javascript警报
- 如何在页面重新加载时显示jquery ui对话框
- 打开相对于鼠标位置的CSS3/HTML5模式对话框
- javascript确认对话框有时会不断出现
- 如何为javascript方法放入jquery确认对话框
- Jquery UI对话框不会消失
- 如何从自定义对话框编辑数据网格中的选定行
- OnsenUI、Angular和在警报对话框后刷新UI组件
- 对话框函数错误无效函数
- 引导程序3:删除确认对话框无效