JSFiddle - React, Tailwind, and code Playground
HTML
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://code.jquery.com/ui/1.11.4/themes/ui-lightness/jquery-ui.css">
<script src="https://code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<div id="calendar"></div>
CSS
table.ui-datepicker-calendar tbody td.highlight > a {
color: #363636;
border: 1px solid #FFDE2E;
}
JavaScript
$(document).ready(function () {
var events = [{
Title: "Five K for charity",
Date: new Date("07/02/2015")
}, {
Title: "Dinner",
Date: new Date("07/15/2015")
}, {
Title: "Meeting with manager",
Date: new Date("07/27/2015")
}];
$("#calendar").datepicker({
beforeShowDay: function (date) {
var result = [true, '', null];
var matching = $.grep(events, function (event) {
return event.Date.valueOf() === date.valueOf();
});
if (matching.length > 0) {
result = [true, 'highlight', matching[0].Title];
}
return result;
},
onSelect: function (dateText, obj) {
var date,
selectedDate = new Date(dateText),
i = 0,
event = null;
selectedDate = new Date(selectedDate.getTime() + selectedDate.getTimezoneOffset() * 60 * 1000);
while (i < events.length && !event) {
date = new Date(events[i].Date);
if (selectedDate.valueOf() === date.valueOf()) {
event = events[i];
}
i++;
}
if (event) {
var options = {
content: event.Title,
container: 'calendar'
};
title = event.Title;
$("[title='" + title + "']").popover(options).popover('toggle');
console.log('fff');
}
}
});
$(document).on('click', 'table.ui-datepicker-calendar tbody td', function () {
console.log(this)
});
});