change variable on click (jQuery)
Hello,
I'm trying to change the date background color "on-click"
This is my function for the buttons. If I check the console.log it is working fine;
- (datesOne and datesTwo are defined in a sting)
var caldates = "";
$('.button-one').click(function () {
var caldates = datesOne;
console.log(caldates) -------> it is giving me the correct info in my console
});
$('.button-two').click(function () {
var caldates = datesTwo;
console.log(caldates) -------> it is giving me the correct info in my console
});
Depending on the button the variable is changed but it can not "reach" my datepicker beforeShowDay
- beforeShowDay: function (date) {
return caldates[$.datepicker.formatDate($.datepicker.ATOM, date)] || [true, "", ""]
},
I need some help to figure out how to change and set the variable correctly
Thanks