'variable from Bootbox input
I'm using bootbox for the first time. I'm using fullcalendar.io and instead of using basic alerts I have to use bootbox.
When I click on a day of the calendar a bootbox alert pops up and inside of it I have to receive in input the title of the event to add on the calendar, and the type of the event (meeting or ...).
The problem is that I don't know how to create inputs in a bootbox alert and, even if I did, I don't know how to then use this 2 inputs result as a variable to add them into the calendar.
const events = [];
document.addEventListener('DOMContentLoaded', function () {
var calendarEl = document.getElementById('calendar');
var calendar = new FullCalendar.Calendar(calendarEl, {
selectable: true,
initialView: 'dayGridMonth',
headerToolbar: {
left: 'prev,next today',
center: 'title',
right: 'dayGridMonth,timeGridWeek,timeGridDay'
},
dateClick: function (dateClickInfo) {
createEvent(dateClickInfo.dateStr, 'Some event', undefined);
bootbox.prompt("Inesrt the name of the event", function (title) {
}
},
});
calendar.render();
}),
function createEvent(title) {
const event = {
title: "",
type: ""
}
events.push(event);
};
This is my super-basic code. I don't even know how to add the second input for the type of the event to the same bootbox. (I think I need to use the same bootbox because it calls the function who needs to have both the variables).
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
