简体   繁体   English

Bootstrap:创建确认对话框

[英]Bootstrap: Create confirm dialog

I use the simple trick suggested here for create a confirm dialog in javascript. 我使用此处建议的简单技巧在javascript中创建确认对话框。

When I click on the anchor the dialog appears, but I can't close it, and the action starts automatically, even is the dialog is not dismiss. 当我单击锚点时,将显示对话框,但无法将其关闭,并且该操作会自动开始,即使对话框未关闭也是如此。

I obtain the following error: 我收到以下错误:

TypeError: $(...).modal is not a function
[Break On This Error]   

$('#dataConfirmModal').modal({show:true});

You have to add reference to the twitter bootstrap library 您必须添加对twitter bootstrap库的引用

http://twitter.github.io/bootstrap/assets/js/bootstrap-modal.js http://twitter.github.io/bootstrap/assets/js/bootstrap-modal.js

see working sample in http://jsfiddle.net/pcwD9/ 请参阅http://jsfiddle.net/pcwD9/中的工作示例

<a href="delete.cfm" data-confirm="Are you sure you want to delete?">Delete</a>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM