When it comes to inserting text below each day in a datepicker, I attempted to use the beforeShowDay
function. According to the documentation, the return value of beforeShowDay
should include the following properties:
- enabled (Boolean)
- classes (String)
- tooltip (HTML attribute title)
By setting the tooltip
to titleAttr
, I expected to see multiple a
tags with the title
attribute set to titleAttr
in the datepicker. However, I didn't observe any tags with the title
attribute. Am I misunderstanding something here?
$datepicker = $('.input-group.date');
$datepicker.datepicker({
beforeShowDay: function(date) {
return [true, "", "titleAttr"];
}
});
.datepicker td a[title]:after {
content: attr(title);
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.6.4/css/bootstrap-datepicker3.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.6.4/js/bootstrap-datepicker.js"></script>
<div class="input-group date pull-right" style="width: 150px;">
<input type="text" class="form-control" />
<div class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</div>
</div>