- bookings stay between 8:00 and 18:00, and out of Room 3 while it is cleaned at noon (
blockedTimes), - a room cannot be booked twice at the same time (
allowOverlap: false), - the board meeting cannot be deleted (an
appointmentDeletinghandler).
blockedTimes),allowOverlap: false),appointmentDeleting handler).jqxScheduler keeps bookings out of blocked times - here outside office hours and while Room 3 is cleaned - and, with allowOverlap set to false, stops a room being booked twice. appointmentAdding, appointmentChanging and appointmentDeleting say why a change was turned down, and let the application add rules of its own: here the board meeting cannot be deleted.
A live JavaScript/jQuery example of jqxScheduler, the jQWidgets Scheduler component, with its complete source code below. It is one of 45 jqxScheduler demos for jQuery.
allowOverlap property – Sets or gets whether appointments may overlap.blockedTimes property – Sets or gets the times that cannot be booked: an array of { from, to, resourceId, recurrenceRule, text }.appointmentDataFields property – Sets or gets the appointments data fields.date property – Sets or gets the Scheduler's Date.height property – Sets or gets the Scheduler's height.ready property – Sets a function called when the Scheduler is rendered and ready for usage.resources property – Sets or gets the Scheduler's resource object.showLegend property – Sets or gets whether the Scheduler's legend bar is displayed.source property – Sets or gets the Scheduler appointments data source.views property – Sets or gets the Scheduler's views.view property – Sets or gets the Scheduler's view.width property – Sets or gets the Scheduler's width.appointmentAdding event – This event is triggered before an appointment is added - from the edit dialog, the addAppointment method or the AI module - and can cancel it.appointmentDeleting event – This event is triggered before an appointment is deleted - from the edit dialog or by the deleteAppointment method - and can cancel it.addAppointment method – Adds a new appointment.findAvailableSlots method – Returns free times for a new appointment, earliest first: [{ from, to, resourceId }], from and to as $.jqx.date values.scrollToTime method – Scrolls the day or week view so that a time of day is at its top, for example the start of the working day.To run it in your own page, load jqx.base.css, a theme and the library files below from npm (npm install jqwidgets-scripts) or the jsDelivr CDN, then add the markup and the script. jQuery is not required: jqxcore.js provides $. Getting started with jqxScheduler shows the setup step by step.
The page loads jqx.base.css, a theme and these library files: jqxcore.js, jqxbuttons.js, jqxscrollbar.js, jqxdata.js, jqxdate.js, jqxscheduler.js, jqxscheduler.api.js, jqxdatetimeinput.js, jqxmenu.js, jqxcalendar.js, jqxtooltip.js, jqxwindow.js, jqxcheckbox.js, jqxlistbox.js, jqxdropdownlist.js, jqxnumberinput.js, jqxradiobutton.js, jqxinput.js.
It also loads helper scripts of this demo site, which are not part of the library: demos.js (getWidth() and other layout helpers).
$(document).ready(function () {
var day = function (hour, minute) {
return new Date(2026, 10, 18, hour, minute || 0, 0);
}
var appointments = [
{ id: "board", subject: "Board meeting", room: "Room 1", start: day(9), end: day(11) },
{ id: "design", subject: "Design review", room: "Room 2", start: day(10), end: day(11, 30) },
{ id: "customer", subject: "Customer call", room: "Room 3", start: day(13), end: day(14) },
{ id: "sprint", subject: "Sprint planning", room: "Room 1", start: day(14), end: day(16) },
{ id: "oneonone", subject: "One-to-one", room: "Room 2", start: day(16, 30), end: day(17) }
];
var source =
{
dataType: "array",
dataFields: [
{ name: 'id', type: 'string' },
{ name: 'subject', type: 'string' },
{ name: 'room', type: 'string' },
{ name: 'start', type: 'date' },
{ name: 'end', type: 'date' }
],
id: 'id',
localData: appointments
};
var adapter = new $.jqx.dataAdapter(source);
$("#scheduler").jqxScheduler({
date: new $.jqx.date(2026, 11, 18),
width: '100%',
height: 520,
source: adapter,
view: 'dayView',
showLegend: true,
// bookings have times: no all-day row
showAllDayRow: false,
ready: function () {
// the day starts at opening time
$("#scheduler").jqxScheduler('scrollToTime', 8);
},
resources:
{
colorScheme: "scheme05",
dataField: "room",
orientation: "horizontal",
source: new $.jqx.dataAdapter(source)
},
appointmentDataFields:
{
from: "start",
to: "end",
id: "id",
subject: "subject",
resourceId: "room"
},
views:
[
{ type: "dayView", workTime: { fromDayOfWeek: 1, toDayOfWeek: 5, fromHour: 8, toHour: 18 }, timeRuler: { formatString: "HH:mm" } }
],
// times that cannot be booked: closed outside 8:00-18:00 every day, and Room 3 is cleaned at noon
blockedTimes: [
{ from: new Date(2026, 0, 1, 0, 0), to: new Date(2026, 0, 1, 8, 0), recurrenceRule: "FREQ=DAILY", text: "Closed" },
{ from: new Date(2026, 0, 1, 18, 0), to: new Date(2026, 0, 2, 0, 0), recurrenceRule: "FREQ=DAILY", text: "Closed" },
{ from: new Date(2026, 0, 1, 12, 0), to: new Date(2026, 0, 1, 13, 0), recurrenceRule: "FREQ=DAILY", resourceId: "Room 3", text: "Cleaning" }
],
// a room cannot be booked twice at the same time
allowOverlap: false
});
// ---- what the rules decided ----
var time = function (date) {
return date.toString('HH:mm');
}
var show = function (allowed, text) {
$("#status").removeClass("allowed blocked").addClass(allowed ? "allowed" : "blocked")
.empty().append($("<strong></strong>").text(allowed ? "Allowed." : "Not allowed."), document.createTextNode(text));
}
var log = function (text) {
$("#log").prepend($("<div></div>").text(new Date().toLocaleTimeString() + " " + text));
}
// blockedTimes and allowOverlap decide before the handler runs: a change they turn down
// arrives with event.args.cancel set and event.args.reason saying why
$("#scheduler").on('appointmentAdding appointmentChanging', function (event) {
var args = event.args;
var appointment = args.appointment;
var change = args.oldAppointment ? time(args.oldAppointment.from) + "-" + time(args.oldAppointment.to) + " → " : "";
log(event.type + " (" + args.action + ") “" + appointment.subject + "” " + change + time(appointment.from) + "-" + time(appointment.to) +
(args.cancel ? " - cancelled, " + args.reason.type : ""));
if (args.cancel) {
show(false, args.reason.message + ".");
}
else {
show(true, "“" + appointment.subject + "” is " + time(appointment.from) + "-" + time(appointment.to) + " in " + appointment.resourceId + ".");
}
});
// free hours, the rules taken into account; a click books one
$("#find").jqxButton();
$("#find").on('click', function () {
var slots = $("#scheduler").jqxScheduler('findAvailableSlots', { duration: 60, maxSlots: 6 });
$("#slots").empty();
if (!slots.length) {
$("#slots").text("No free hour today.");
}
$.each(slots, function (i, slot) {
$("<button type='button'></button>").text(slot.resourceId + ", " + time(slot.from) + "-" + time(slot.to)).appendTo("#slots").jqxButton().on('click', function () {
$("#scheduler").jqxScheduler('addAppointment', { subject: "New booking", start: slot.from.toDate(), end: slot.to.toDate(), room: slot.resourceId });
$("#find").trigger('click');
});
});
});
// a rule of the application's own: the board meeting is locked
$("#scheduler").on('appointmentDeleting', function (event) {
var appointment = event.args.appointment;
var locked = appointment.id === "board";
log("appointmentDeleting “" + appointment.subject + "”" + (locked ? " - cancelled" : ""));
if (locked) {
event.cancel = true;
// the edit dialog shows a reason's message too
event.args.reason = { type: "locked", message: "The board meeting is locked and cannot be deleted" };
show(false, event.args.reason.message + ".");
}
else {
show(true, "“" + appointment.subject + "” deleted.");
}
});
});
<div id="content" class="demo">
<div class="demo-intro">
Drag, resize, edit, add or delete bookings. Each change is checked before the scheduler makes it:
<ul>
<li>bookings stay between 8:00 and 18:00, and out of Room 3 while it is cleaned at noon (<code>blockedTimes</code>),</li>
<li>a room cannot be booked twice at the same time (<code>allowOverlap: false</code>),</li>
<li>the board meeting cannot be deleted (an <code>appointmentDeleting</code> handler).</li>
</ul>
</div>
<div id="scheduler"></div>
<div class="demo-bar">
<input type="button" id="find" value="Find a free hour">
<div id="slots" class="demo-slots" aria-live="polite"></div>
</div>
<div id="status" class="demo-status" role="status" aria-live="polite">Try moving the design review into Room 1 at 10:00.</div>
<div id="log" class="demo-log" aria-label="Event log"></div>
</div>