I want to make it that when a user opens this page it will be displayed LIVE FDP REPORT AS OF {Todays date time}
the title that needs to have todays date
I tried to use Javascript to implement this:
script<
document.getElementById("current_date").value = Date();
></script>
<input id="current_date" readonly></>
2
Answers
The JS code to set the
value
of yourinput
is correct – although it could be improved by including thenew
keyword.The issue seems to be with how you’ve structured your HTML. The
script
needs to be HTML tags which contain the JS logic.Here’s a full example of how the entire HTML should look, in a simplified example. I’m sure your actual page will have more code than this, but the important part is the
<script>
tag, and where it’s located: