Hello
I have two textfield and dropdown, i want add date to the first textfield and when change dropdown menu add year or month dynamically to the second text-field
and I used this code but it give
NaN/NaN/NaN
function calDate() {
var dateArr = document.getElementById('date_field1').value;
var date1 = new Date();
date1.setFullYear(dateArr[2],dateArr[1]-1,dateArr[0]);
date1.setDate(date1.getDate()+5);
document.getElementById("date_field2").value = date1.getDate() + "/" + (date1.getMonth()+1) + "/" + date1.getFullYear();