这里我使用jquery在onclick警告框的下面代码中使用,但我需要与onload函数相同的警告框。
<link href="mdl.css" rel="stylesheet" type="text/css">
<style>
.btn {
display: inline-block;
padding: 10px 20px;
background-color: #5D9CEC;
border-bottom: 3px solid #4A89DC;
border-radius: 5px;
color: #fff;
cursor: pointer;
margin:30px 10px;
}
</style
<div class="jquery-script-ads" style="margin:30px auto;">
</div> <a class="btn" id="btn-2" data-type="confirm" data-fullscreen="false" data-overlayClick="true"> Confirm Dialog </a> </div>
<script src="http://code.jquery.com/jquery-1.12.4.min.js"></script>
<script src="mdl.js"></script>
<script>
$('#btn-2').mdl({
content:"Are You Sure To Delete This Entry?"
});
</script>
答案 0 :(得分:0)
使用$.fn.trigger
$('#btn-2').mdl({
content:"Are You Sure To Delete This Entry?"
}).trigger('click')
答案 1 :(得分:-1)
(文档)$。就绪( function(){
alert(" content:"Are You Sure To Delete This Entry?");
}
);