ERROR : javascript.js:61 Uncaught Typeerror: Cannot read Property 'style' of null

Asked

Viewed 393 times

-2

Talk personal, all right? is the following, I have two Forms for registration, but I just want the second to appear when it is clicked next, in the first form I put via css a visibility= Visible and in the second form a visibility = Hidden, and in the javascript when I click next I change the values of the visibility, but only works for the first form, it changes to Hidden but the second does not change to Visible and presents this error : Uncaught Typeerror: Cannot read Property 'style' of null

Follows prints:

HTML:

inserir a descrição da imagem aqui

JS :

inserir a descrição da imagem aqui

I’ll be grateful for your help!!

  • Please click on [Edit] and put the code as text. Putting it as an image is not ideal, understand the reasons reading the FAQ.

  • Anyway, cadastro2 is a class and not an id, so getElementById does not find the element

  • thank you!!!!!!!

1 answer

0


In his second Document.getElementById you are searching for ID but it is actually a class. Change to Document.querySelector(". cadas2") and see if it works.

  • THANK YOU VERY MUCH, JUNIOR. I hadn’t noticed that. Thank you very much indeed.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.