Hi everyone.
i have a form with a date field and a dropdown list.
my intention is to populate the dropdown field automatically with the day chosen from the date picker. it works fine when the fields are not in a collection but doesn't work at all within a collection.
Example :28-03-2017 will populate the dropdown with "Tuesday"
Any help will be greatly appreciated.
$(document).ready(function () { function findDay() { var d = new Date($('#Field15').val()); var weekday = new Array(7); weekday[0]= "Sunday"; weekday[1] = "Monday"; weekday[2] = "Tuesday"; weekday[3] = "Wednesday"; weekday[4] = "Thursday"; weekday[5] = "Friday"; weekday[6] = "Saturday"; var n = weekday[d.getDay()]; $('.dayWeek select').val(n); $('.dayWeek select').trigger('change'); } $('.startDate').on('change', 'input', findDay); });