So I've run into a snag trying to make a date calculator in Javascript. I'm fairly new to Javascript so I feel like I'm diving in a little deep, but here's a rundown of what I'm trying to accomplish.
Here's a jsfiddle: http://jsfiddle.net/b52hamw7/2/
I first have a form in my HTML formatted as follows:
<form>
<p class="instructions">I need my items by:</p><br>
<input type="date" name="date" value="" id="date"/>
<input type="button" value="Submit" id="submit">
</form>
<p>Be sure to order by:</p><p id="dateoutput"></p>
The idea here is that a user will input a date into the form and then a javascript code will add 10 days to it and output the day that they need to order by, formatted as a date.
Here's the script that I have so far, which I know isn't close to working, but it's a start I guess:
<script>
document.getElementsByName("submit").onclick = function() {
var dateIn = document.getElementsById("date").value;
var addDays = 10;
var dateOut = dateIn + addDays;
};
document.getElementById("dateoutput").innerHTML = dateOut;
</script>
I really appreciate any direction you can give me on this one. Thanks in advance!