i want user open webpage and textbox show value of current friday. i don't know how to use .val here is my code.
$(function() {
$("#dateInput").datepicker({
//In Datepicker set the Calendar display start with Sunday (by default datepicker starts from Sunday)
firstDay: 0,
//Before Populating the Calendar set the Enabled & Disabled Dates using beforeShowDay(Date) function
beforeShowDay: function (date) {
//Get today's date
var sunday = new Date();
//Set the time of today's date to 00:00:00
sunday.setHours(0,0,0,0);
sunday.setDate(sunday.getDate() - (sunday.getDay() || 0));
//Set the Date to Sunday
var saturday = new Date(sunday);
var thrusday = new Date(sunday);
var currentday = new Date();
//0 is sunday 6 is saturday
var currentdayofweek = currentday.getUTCDay();
//console.log(currentday, "show currentday");
//alert('value of currentday=>'+currentday);
//alert('value of currentday of week=>'+currentdayofweek);
//location.reload();
//Now add 6 to Sunday to get the Date of Saturday (End of that Week)
saturday.setDate(sunday.getDate() + 6);
//add by kim
thrusday.setDate(sunday.getDate() + 4);
//edit by kim
//return [(date >= thrusday && date <= saturday ), ''];
// current day of week <5 mean user can select friday only day before friday
return [(date > thrusday && date < saturday && currentdayofweek < 5), ''];
}
});
var temp = $("#dateInput").datepicker("option", "dateFormat", "yy-mm-dd");
return temp;
});
and here is textbox code.
<input type="text" name="dateInput" id="dateInput"/>
- i just want user can select only friday of current week in calendar
- and value of friday in current week should show in text box before user select