.Highlighted a{
background-color : Green !important;
background-image :none !important;
color: White !important;
font-weight:bold !important;
font-size: 9pt;
}
$(document).ready(function () {
var date1 = new Date(2014, 5, 6);
var date2 = new Date(2014, 5, 17);
$('#datepicker').datepicker({
dateFormat: "mm/dd/yy",
beforeShowDay: function (date) {
if (date == date1 ) {
return [true, 'Highlighted', 'Available Date'];
}
return [false, '', ''];
}
});
});
This one doesn't work, because of date==date1
. If I change it to date<=date1
, it works fine. I thought javascript is a weakly typed language and it compares the content, rather than reference. I don't wanna do something like (date.getDay==date1.getDay &&....)
. Is there an easier way to compare the values?
datepicker({ beforeShowDay: function( date ) { var highlight = eventDates[date]; if( highlight ) { return [true, "event", 'Tooltip text']; } else { return [true, '', '']; } } }); The complete JavaScript code to highlight specific dates.
Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project. Step 2 − Add the following code to res/layout/activity_main. xml. Kindly fine the highlighted code, this is the simplest way to change the colour of your datePicker.
To change the position of the jQuery UI Datepicker just modify . ui-datepicker in the css file. The size of the Datepicker can also be changed in this way, just adjust the font size.
Try using a more recent version of jQuery UI that is compatible with jQuery 1.9+. See Uncaught TypeError: Cannot read property 'msie' of undefined - jQuery tools. Consider using jQuery 1.9. 1, but it appears to work fine with 1.9.
Use the +
unary operator (reference) to convert the values to numerics for comparison.
The unary + operator converts its operand to Number type.
if (+date === +date1 ) {
return [true, 'Highlighted', 'Available Date'];
}
OR
if (!(date - date1)) {
return [true, 'Highlighted', 'Available Date'];
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With