Help w/ dynamic dates (java+html)

  • 27 July 2021
  • 0 replies
  • 30 views

Hello! We’re looking to add multiple dynamic date fields to Unbounce. We’ve successfully created the java+html so the date displays, but when trying to populate it again within another field on the page (using the same code) we were unsuccessful. I’m not sure how to duplicate this, any help would be great!

Here’s the javascript we’re using:
var months = [‘January’,‘February’,‘March’,‘April’,‘May’,‘June’,‘July’, ‘August’,‘September’,‘October’,‘November’,‘December’]; var today = new Date(); today.setTime(today.getTime()); document.getElementById(“newDate”).innerHTML = months[today.getMonth()] + " " + today.getDate()+ ", " + today.getFullYear()

Here’s the html we’re using:
id=“newDate” style=“align: center; font-weight: 100; font-family: PT Sans; font-size: 16px; color: rgb(107, 107, 107);”

Maybe we need to use unique id=“newDate2” ?

Thanks,
Cliff


0 replies

Be the first to reply!

Reply