Jump to content

Unable to display date on clicking button


shomeronyfsbca
 Share

Recommended Posts

getElementsByTagName gets the element with the name provided., like "a" for <a> and "div" for <div class="example">.

Also, if you want to create a Date, you'll need to create the object, otherwise you'll be left with the object definition to output. (Or something of the sort)

You'll instead want this inside your code.

document.getElementsByTagName('p')[0].innerHTML = new Date();

 

You can also paste code by using the code block button! So you won't need to use (very limited) attachment space putting in screenshots.

XcQfW3F.png

Link to comment
Share on other sites

On 4/8/2019 at 4:39 PM, Funce said:

You can also paste code by using the code block button! So you won't need to use (very limited) attachment space putting in screenshots.

XcQfW3F.png

Plus you are relying on a very poor typist (me) to enter your less than visually optimal code to test! 😖

  • Haha 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...