Search code examples
javascriptbootbox

on Event Clicked issue


I'm using Bootstrap 4 Beta and JavaScript for my university project, I'm making some calendar event function. and I'm used Bootbox.js for popup, my issue is When I click the calendar event alert is display but this alert cant customize ,I want to know how to added <div> <button> text and etc for this alert, look my attached image, you can understand it

This is my script,

event

 dp.events.list = [{
      start: "2017-12-20",
      end: "2017-12-28",
      id: "1",
         resource: "A",
      text: "Mahesh",
      backColor: "#70CB85",


    },

click

dp.onEventClicked = function(args) {
 bootbox.alert(" " + args.e.text()); //Alert
};

enter image description here


Solution

  • As from their documentation:

    An alert callback should not supply an argument; it will be ignored

    If you want to pass a button you can use confirm:

    bootbox.confirm({
        message: "This is a confirm with custom button text and color! Do you like it?",
        buttons: {
            confirm: {
                label: 'Yes',
                className: 'btn-success'
            },
            cancel: {
                label: 'No',
                className: 'btn-danger'
            }
        },
        callback: function (result) {
            // ...
        }
    });
    

    Or use Dialog:

    bootbox.dialog({ message: '<div class="text-center"><i class="fa fa-spin fa-spinner"></i> Loading...</div>' })