嗨,我有一个像这样的 html 按钮
<button type="button" runat="server" id="btnDelete" type="button" data-confirm-message="Deleting this page will permanently delete it from the system and it will not be recoverable. Are you sure you wish to continue?">delete</button>
生成这个html
<button onclick="if (typeof(Page_ClientValidate) == 'function') Page_ClientValidate(''); __doPostBack('ctl00$body$btnDelete','')" id="btnDelete" type="button" data-confirm-message="Deleting this page will permanently delete it from the system and it will not be recoverable. Are you sure you wish to continue?">delete</button>
和一些 jQuery
$(document).ready(function () {
$("#btnDelete").click(function () {
return confirm($(this).data("confirm-message"));
});
});
问题是无论确认是真是假,页面都会被发回,任何帮助都会很棒