簡體   English   中英

使用BootstrapDialog進行Bootstrap切換

[英]Bootstrap Toggle with BootstrapDialog

勞駕,

是否有可能以顯示引導切換message領域BootstrapDialog

例如:

BootstrapDialog.show({
  title: 'Information',
  message: '<input class="toggleExample" type="checkbox" data-toggle="toggle">'
});

另外,我嘗試在BootstrapDialog之前和BootstrapDialog之后初始化$('.toggleExample') ,但是它們都沒有起作用。

BootStrap dialog插件是基於bootstrap 3庫構建的, Bootstrap dialog也是基於bootstrap 2庫構建的。

因此這兩個插件都可以與內核庫的不同版本一起使用,因此您無法將兩個插件的功能組合在一起。

有關更多信息,請參閱插件官方網站:

只需嘗試根據您的需要此代碼,這將彈出帶有復選框和按鈕。

BootstrapDialog.show({
    message: function (dialogItself) {
        var $form = $('<form></form>');
        var $titleDrop = $('<input type="checkbox" />');
        dialogItself.setData('field-title-drop', $titleDrop);   // Put it in dialog data's container then you can get it easier by using dialog.getData() later.
        $form.append('<label>Click Here</label>').append($titleDrop);

        return $form;
    },
    buttons: [{
        label: 'OK.',
        action: function (dialogItself) {
            alert(dialogItself.getData('field-title-drop').val());
        }
    }]
});

試試這個演示: http : //jsfiddle.net/7DcHW/30/

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM