在 jQuery 中是否有自定义标题和内容的 alert
和 confirm
对话框可用。我已经搜索了许多网站,但没有找到合适的。欢迎提供任何网站链接或内容。
在 jQuery 中是否有自定义标题和内容的 alert
和 confirm
对话框可用。我已经搜索了许多网站,但没有找到合适的。欢迎提供任何网站链接或内容。
我使用了 jquery UI
组件制作了自定义的消息框。这里是演示:http://jsfiddle.net/eraj2587/Pm5Fr/14/
你只需传递标题、消息和按钮文本等参数即可。您可以在任何按钮点击时指定触发函数。这将有助于您。
Failed to load resource: the server responded with a status of 404 (Not Found) http://code--projects.com/custom-dialog/images/ui-icons_222222_256x240.png Failed to load resource: the server responded with a status of 404 (Not Found) http://code--projects.com/custom-dialog/images/ui-bg_highlight-hard_100_f9f9f9_1x100.png Failed to load resource: the server responded with a status of 404 (Not Found)
- Rajaram Shelar试试使用SweetAlert,它是最好的选择。 您将获得很多自定义和灵活性。
sweetAlert(
{
title: "Are you sure?",
text: "You will not be able to recover this imaginary file!",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "Yes, delete it!"
},
deleteIt()
);
请查看jsfiddlehttp://jsfiddle.net/CdwB9/3/并单击删除。
function yesnodialog(button1, button2, element){
var btns = {};
btns[button1] = function(){
element.parents('li').hide();
$(this).dialog("close");
};
btns[button2] = function(){
// Do nothing
$(this).dialog("close");
};
$("<div></div>").dialog({
autoOpen: true,
title: 'Condition',
modal:true,
buttons:btns
});
}
$('.delete').click(function(){
yesnodialog('Yes', 'No', $(this));
})
这将对你有所帮助
jQuery UI 有自己的元素,但是仅使用 jQuery 是没有的。
工作示例:
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>jQuery UI Dialog - Default functionality</title>
<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://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css" />
<script>
$(function() {
$( "#dialog" ).dialog();
});
</script>
</head>
<body>
<div id="dialog" title="Basic dialog">
<p>This is the default dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.</p>
</div>
</body>
</html>