我使用引導程序確認創建了以下彈出確認並希望觸發此確認onClose事件的Dropdownlist。儘管我可以在Dropdownlist的每個關閉點都獲得控制檯日誌,但我無法在onClose上顯示確認窗口。有沒有辦法手動啓動它?無法啓動引導程序確認
@Html.DropDownListFor(m => m.GroupId, new SelectList(Model.Groups, "Value", "Text"),
"Select", new { data_toggle = "confirmation" })
$('#GroupId').on('select2:close', onClose)
function onClose(evt) {
console.log('close...'); //this line is executed
//I think the problem is related to this part. I might be using it on the wrong section
var Confirmation = require('confirmation-popover');
var confirm = new Confirmation({
rootSelector: '[data-toggle=confirmation]',
// other options
selector: '[data-toggle="confirmation"]',
title: 'Are you sure?',
placement: 'top',
btnOkIcon: 'glyphicon glyphicon-ok',
btnOkClass: 'btn btn-sm btn-success',
btnOkLabel: 'Yes',
btnCancelIcon: 'glyphicon glyphicon-remove',
btnCancelClass: 'btn btn-sm btn-danger',
btnCancelLabel: 'No'
});
confirm.show(el);
}
$( 「#的GroupId」)上( 「變」,功能(E){的OnClose(E);})應該工作,請嘗試。 –
該問題與調用方法onClose無關,實際上問題與如何激發bootstrap-confirmation有關,我不知道如何正確定義它以便手動點燃。任何想法? –
https://ethaizone.github.io/Bootstrap-Confirmation/#,當你想開火嗎?在下拉菜單中選擇選項? –