jquery确认插件不工作
我正在使用jquery1.8.3试用jquery插件。但是事件处理程序(警报)对这两个按钮都不起作用jquery确认插件不工作,jquery,jquery-plugins,confirm,Jquery,Jquery Plugins,Confirm,我正在使用jquery1.8.3试用jquery插件。但是事件处理程序(警报)对这两个按钮都不起作用 <!DOCTYPE html> <html> <body> <button class="confirm" type="button">Delete the comment</button> <link rel="stylesheet" href="http://netdna.bootstrapcdn.com/boo
<!DOCTYPE html>
<html>
<body>
<button class="confirm" type="button">Delete the comment</button>
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" />
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-theme.min.css" />
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="http://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script src="jquery.confirm.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$(".confirm").confirm({
text: "Are you sure you want to delete that comment?",
title: "Confirmation required",
confirm: function(button) {
alert("foo")
},
cancel: function(button) {
alert("bar")
},
confirmButton: "Yes I am",
cancelButton: "No",
post: true
});
});
</script>
</body>
</html>
删除评论
$(文档).ready(函数(){
$(“.confirm”).confirm({
文本:“您确定要删除该评论吗?”,
标题:“需要确认”,
确认:功能(按钮){
警报(“foo”)
},
取消:功能(按钮){
警报(“条”)
},
confirmButton:“是的,我是”,
取消按钮:“否”,
波斯特:是的
});
});
有什么线索吗?试试这样:
$(document).ready(function(){
$(".confirm").click(function(){
$.confirm({
'message': "Are you sure you want to delete that comment?",
'title': "Confirmation required",
'buttons': {
'Yes': {
'action': function(){
alert();
}
},
'No': {
'action': function(){
alert()
}
}
});
});
});
我不明白你为什么要把一个按钮作为参数。如果你看一下需求,它会说Bootstrap 3用于modalsupdated Bootstrap 3的代码,但是modal.modal('show')的confirm.js文件中有错误;如果你也使用css,它现在可以正常工作,没有错误,但是对于任何一个按钮,警报仍然没有出现,而整个模式是不成功的。尽管按钮可以在那里使用//modal.find(“.confirm”)。单击(函数(){settings.confirm(settings.button);});