0

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,

  1. fill in dateIn
  2. press button
  3. date displayed on dateOut picker

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?

1 Answer 1

4

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Thankyou very much, and how do I get the console open in Dreamweaver?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.