集合Bootstrap自定义confirm提示效果

这里写图片描述

js端

var Common = { confirm:function(params){ var model = $("#common_confirm_model"); model.find(".title").html(params.title) model.find(".message").html(params.message) $("#common_confirm_btn").click() //每次都将监听先关闭,防止多次监听发生,确保只有一次监听 model.find(".cancel").die("click") model.find(".ok").die("click") model.find(".ok").live("click",function(){ params.operate(true) }) model.find(".cancel").live("click",function(){ params.operate(false) }) } }

html端

<input type="hidden" data-toggle="modal" data-target="#common_confirm_model"> <div> <div> <div> <div> <button type="button" data-dismiss="modal"> <span aria-hidden="true">&times;</span> <span>Close</span></button> <h5><i></i> <span></span> </h5> </div> <div> <p ><span></span></p> </div> <div > <button type="button" data-dismiss="modal">确认</button> <button type="button" data-dismiss="modal">取消</button> </div> </div> </div> </div>

调用

Common.confirm({ title: "标题", message: "内容", operate: function (reselt) { if (reselt) { ........ } else { ........ } } })

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wyzxzg.html