I need to increment a few different numbers in the same HTML ID every 24 hours. So if one number is at 1 and the other is at 20 regardless of what the number it is must be incremented by 1.
As you can see I just need a way to increment any number in the HTML ID by +1 instead of changing the number to 1. Here is my code
<p id="pColor">
Flower are on day <span>(<span id="datePlus">1</span>)</span>
</p>
<p id="pColor">
Fruiting Plants are on day <span>(<span id="datePlus">20</span>)</span>
</p>
JS
function theDate() {
var initialDate = new Date(2017, 0, 19); // Dec 1st 2012
var now = Date.now();
var difference = now - initialDate;
var millisecondsPerDay = 24 * 60 * 60 * 1000;
var daysSince = Math.floor(difference / millisecondsPerDay);
console.log(daysSince);
function dateUpdate() {
if(daysSince >=1) {
console.log("True");
// THIS IS WHERE I WANT CODE TO GO
} else {
console.log("false");
}
}
}
theDate();
<span id="datePlus">20</span>first make datePlus unique. Either use this as a class name.