My problem is that i want to get a value of a function but its returning [object][object]. just see my code.where is the error..
function existing_time(nxtDay) {
var time = 1;
return $('input[name="date[]"]').each(function () {
var selectedDate = $(this).val();
var idName = $(this).get(0).id;
var times = 1;
if (selectedDate == nxtDay) {
//alert(idName);
//alert(selectedDate);
var idNo = idName.substr(10);
alert(idNo);
times = $("#timepicker_" + idNo).val();
alert(times);
console.log("times", times)
return times;
}
});
//alert(time_1);
if (time_1 == 1) {
return time;
} else {
return time_1;
}
}
In loop it alerts correct value bt i could not get the value outside the function.please help me...