Good morning from Santo Domingo
I love Jquery !!!!!!
Please help me with this , I'm using Jquery datepicker daterange and I need to disable some days dinamically controlled from a textbox on my form. The default value of the textbox is [2, 4, 5] and i want to pass this value to the var daysToDisable like this :
var daysToDisable = document.myform.mytextbox.value;
instead of : var daysToDisable = [2, 4, 5];
But it's not working . Why it's not working , where is the prolem ?
This is the code:
- $(function () {
- var daysToDisable = [2, 4, 5];
- $("#from").datepicker({
- beforeShowDay: disableSpecificWeekDays,
- defaultDate: "+1w",
- changeMonth: true,
- numberOfMonths: 3,
- onClose: function (selectedDate) {
- $("#to").datepicker("option", "minDate", selectedDate);
- }
- });
- function disableSpecificWeekDays(date) {
- var day = date.getDay();
- for(i = 0; i < daysToDisable.length; i++) {
- if($.inArray(day, daysToDisable) != -1) {
- return [false];
- }
- }
- return [true];
- }
- $("#to").datepicker({
- defaultDate: "+1w",
- changeMonth: true,
- numberOfMonths: 3,
- onClose: function (selectedDate) {
- $("#from").datepicker("option", "maxDate", selectedDate);
- }
- });
- });