0
我使用blueimp jQuery文件上傳和引導對話框(https://nakupanda.github.io/bootstrap3-dialog/),有沒有辦法使用blueimp從引導對話框按鈕(BootstrapDialog.show)上傳?似乎無法找到在引導對話框按鈕上創建jQuery選擇器並將其掛接到文件上載的方法。有沒有辦法使用blueimp從引導對話框上傳?
我使用blueimp jQuery文件上傳和引導對話框(https://nakupanda.github.io/bootstrap3-dialog/),有沒有辦法使用blueimp從引導對話框按鈕(BootstrapDialog.show)上傳?似乎無法找到在引導對話框按鈕上創建jQuery選擇器並將其掛接到文件上載的方法。有沒有辦法使用blueimp從引導對話框上傳?
如果您在這一刻唯一關心的是建立在一個引導對話框按鈕jQuery選擇,請嘗試以下:
BootstrapDialog.show({
\t title: 'Example',
message: 'Write your example here.',
buttons: [{
\t id: 'btn-close',
\t \t label: 'Close',
action: function(dialog) {
\t dialog.close();
}
}],
onshown: function(dialog) {
// This is a jQuery object
\t var $btnClose = dialog.getButton('btn-close');
$btnClose.hide();
}
});
在這個例子中,你可以通過獲得按鈕id通過對話框實例的getButton()方法,返回的對象是用jQuery包裝的按鈕。
這裏一個的jsfiddle http://jsfiddle.net/ubx2mbmz/1/
你也可以做一個傳統的jQuery的方式相似:
BootstrapDialog.show({
\t title: 'Example',
message: 'Write your example here.',
buttons: [{
\t \t label: 'Close',
action: function(dialog) {
\t dialog.close();
}
}],
onshown: function(dialog) {
\t var $btnClose = dialog.getModalFooter().find('button');
$btnClose.hide();
}
另外這裏的jsfiddle http://jsfiddle.net/7ftsc50n/1/
感謝那些爲我工作@badboy ! – afzal273