I need your help with Elementor.
I added a textbox and I want the content of this message showing days (number) like this:
"Special price: CurrentDay - 2, CurrentDay - 1 and CurrentDay of CurrentMonthText
(today is the last day you can buy this product)."
Example: Special price: 18, 19 and 20 of July (today is the last day you can buy this product)
Which code I need to insert on the textbox to leave automatic this days and month counting?
I tried this code below and it worked on elementor editor page, but not worked on the real page. If i put document.write(today);
inside the script, the code works on real page, but the elementor editor page turn into a blank page showing only my code result. Any ideas?
<script>
var today = new Date();
var d1 = String(today.getDate()).padStart(2, '0');
var d2 = String(today.getDate()-1).padStart(2, '0');
var d3 = String(today.getDate()-2).padStart(2, '0');
const monthNames = ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho",
"Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"];
const d = new Date();
today = "⚠️Special price: " + d3 + ", " + d2 + " e " + d1 + " de "
+ monthNames[d.getMonth()] + " (It ends today) ";
document.getElementById('message').innerHTML = today;
</script>
<p id="message"></p>
Best Regards!