UPDATED: The code below works to show dates 7 and 14 days from today. How can we shorten the output to just show the month and day (Sep 21)?
How do show the dates (innerHTML) for every class name on the page?
var date = new Date,
firstDate = new Date(date.getFullYear(), date.getMonth(), date.getDate() + 7),
next = new Date(date.getFullYear(), date.getMonth(), date.getDate() + 14),
months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep",
"Oct", "Nov", "Dec"
];
$('.first-date').html(function(_, val) {
return val + firstDate;
});
$('.second-date').html(function(_, val) {
return val + next;
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
<span class="first-date"></span> - <span class="second-date"></span>
<br/><br/>
<span class="first-date"></span> - <span class="second-date"></span>
JSFiddle: https://jsfiddle.net/dzb2okv3/1/