I am using jQuery DatePicker in my website. I want the two dropdown on datepicker : one is for selecting month and one is for selecting year. Therefore i should write in the below format:
$('.datepicker').datepicker({
changeMonth: true,
changeYear: true
});
I want to make this picker reusable therefore i make a function which takes the format parameters like given below:
function RegisterDateTimePicker(options) {
var test = "{" + options + "}";
$('.date').datepicker(test);
}
The parameter "options" above is a variable which consist of string
"changeMonth: true, changeYear: true"
Now datepicker is not showing. The error i get while debugging is:
Uncaught TypeError: Cannot call method 'apply' of undefined
kindly provide the way to get rid of this problem?