HTML
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>对话框 - mdui.confirm()</title>
<link rel="stylesheet" href="https://cdn.w3cbus.com/library/mdui/1.0.2/css/mdui.min.css"/>
</head>
<body class="mdui-theme-primary-indigo mdui-theme-accent-pink">
<div class="mdui-container">
<button class="mdui-btn mdui-color-theme-accent mdui-ripple" id="example-confirm-1">demo1</button>
<button class="mdui-btn mdui-color-theme-accent mdui-ripple" id="example-confirm-2">demo2</button>
<button class="mdui-btn mdui-color-theme-accent mdui-ripple" id="example-confirm-3">demo3</button>
<button class="mdui-btn mdui-color-theme-accent mdui-ripple" id="example-confirm-4">demo4</button>
</div>
<script src="https://cdn.w3cbus.com/library/mdui/1.0.2/js/mdui.min.js"></script>
</body>
</html>
JavaScript
var $ = mdui.$;
$('#example-confirm-1').on('click', function () {
mdui.confirm('content', function () {
mdui.alert('点击了确认按钮');
});
});
$('#example-confirm-2').on('click', function () {
mdui.confirm('content',
function () {
mdui.alert('点击了确认按钮');
},
function () {
mdui.alert('点击了取消按钮');
}
);
});
$('#example-confirm-3').on('click', function () {
mdui.confirm('content', 'title', function () {
mdui.alert('点击了确认按钮');
});
});
$('#example-confirm-4').on('click', function () {
mdui.confirm('content', 'title',
function () {
mdui.alert('点击了确认按钮');
},
function () {
mdui.alert('点击了取消按钮');
}
);
});