Aryo123 Aryo123 - 1 year ago 81
HTML Question

Javascript Code isn't working for Date viewing?

<h1>My First JavaScript</h1>

<button type="button"
onclick="document.getElementById('dem').innerHTML = Date()">
Click me to display Date and Time.</button>

<p id="demo"></p>

Hi I am making a Date pop out Button in Javascrpit and using html too. But Which I click the button in Output page it didn't show to current time of my zone. It should pop out when I click the button in the same page not in different one.

Answer Source

In your's 3rd line their should be demo not dem, if you correct it with demo then it surely pop out the Date. And Good Luck with Your's programming.

onclick="document.getElementById('demo').innerHTML = Date()">
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download