I am trying to make this script to target both of my class element with the same class name, but it is only targeting the first one. How can i make it to target both or all classes with same class name?
https://jsfiddle.net/cprtkhmd/2/`
var d = new Date();
var month = d.getMonth() + 1; //.getMonth() is 0-11
var day = d.getDate();
if (day < 10) {
day = '0' + dd;
}
if (month < 10) {
month = '0' + month;
}
if (document.getElementsByClassName( 'date-display-single day' )[0].innerHTML == `${day}.${month}`) {
document.getElementById("mydivid").className += " today";
}
.today {
border: 2px solid red;
color: red;
}
<div id="mydivid">
<span class="date-display-single day" property="dc:date" datatype="xsd:dateTime" content="2019-02-24T11:30:00+01:00">24.02</span>
</div>
<div id="mydivid">
<span class="date-display-single day" property="dc:date" datatype="xsd:dateTime" content="2019-02-24T11:30:00+01:00">24.02</span>
</div>
`