Reputation: 333
I'm trying to take a date from a date picker and then output the date to the value of a second picker.
I should work like this,
My code:
<input id="dateIn" name="dateIn" type="date" value=""/>
<input id="dateOut" name="dateOut" type="date" value=""/>
<button type="button" onclick="FunctionDate()">Click Me!</button>
Here is the function: (It does run when the button is pressed)
function FunctionDate() {
Document.getElementById("dateOut").value = Document.getElementById("dateIn").value;
}
The problem is in the function, but what should run in there?
Upvotes: 0
Views: 734
Reputation: 104795
Forgot the quotes around element ID's:
document.getElementById("dateOut").value = document.getElementById("dateIn").value;
And remove the ()
from the .value
call. Just a tip, always have your console open when writing JS, you'll see the syntax errors.
Upvotes: 4