1
<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.

Aryo123
  • 21
  • 4
  • Possible duplicate of [How do you create a JavaScript Date object with a set timezone without using a string representation](http://stackoverflow.com/questions/439630/how-do-you-create-a-javascript-date-object-with-a-set-timezone-without-using-a-s) – Cookie Ninja Jul 02 '16 at 03:42
  • `('dem')` change this to `('demo')` – Raktim Biswas Jul 02 '16 at 03:46

1 Answers1

0

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()">
Nishan C
  • 89
  • 5