我在提交表單前使用此插件 - https://craftpip.github.io/jquery-confirm/ 進行確認。 這裏是我的HTML:jquery-confirm插件 - 提交表單確認
<form action="" method="post">
<input type="hidden" name="comment_id" value="">
<button name="delete" class="btn btn-danger btn-xs confirm_delete"><span class="glyphicon glyphicon-remove"></span> Delete</button>
</form>
而且我的javascript:
$("button.confirm_delete").confirm({
title: '',
content: 'Please confirm you want to delete this item. This action is irreversible!',
buttons: {
confirm: function() {
this.$target.submit();
},
cancel: function() {
}
}
});
而且一經確認,沒有任何反應。在控制檯,我得到[button.btn.btn-danger.btn-xs.confirm_delete] on this line:this。$ target.submit();我做錯了什麼?
爲什麼不直接說$('form')。submit()? –
頁面上還有其他表單。 – user3628807