KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have a Datepicker with the following code. I have a dropdownbox and upon a change in the dropDown box I want to launch the datePicker beforeShowDay function. How can I do this? var freeDate; Part of my code is as follows: $("#myDiv").datepicker({ showOtherMonths: true, selectOtherMonths: true, dateFormat: "yy/mm/dd", onSelect: function(dateText, inst) {}, onChangeMonthYear: function(year, month, inst) { $.ajax({ contentType: "application/json; charset=utf-8", dataType: "json", url: '@Url.Action("ListDates", "Party")', data: { date: new Date(year, month - 1, 1).toString("yyyy/MM/dd"), userID: userID }, success: function(data) { freeDate = eval(data); }, error: function(request, status, error) {} }); }, beforeShowDay: function(dateToShow) { var returnResult = new Array(); returnResult.push(true); var itemMatched = false; $.each(freeDate, function(key, value) { if (new Date(parseInt(value.substr(6))).compareTo(dateToShow) == 0) { itemMatched = true; returnResult.push('timeNotFree'); return; } }); if (!itemMatched) returnResult.push(''); returnResult.push(''); return returnResult; } }); $('#myList').change(function() { userID = $("#userList > option:selected").attr("value"); // myList is used to have freeDate and the DatePicker must be shown accordingly. $.ajax({ contentType: "application/json; charset=utf-8", dataType: "json", url: '@Url.Action("ListDates", "Party")', data: { date: new Date($("#myDiv").datepicker("getDate").toString("yyyy/MM/dd")), userID: userID }, succes
Tags (comma-separated)
Save Edits
Cancel