Skip to content
Advertisement

Show/Hide elements JavaScript

I am attempting to create forms that are hidden on each page. I figure I had to make a separate functions for each button and form that I wanted to hide. So my logic was to use the same code on separate JS pages but changing the id and function names on each JS page.

However when I do so, using the exact same code the button works on one page and not on the other page.

This is a start of many layers I’m trying to learn, such as opening form on same page and transition it to appear using jQuery.

  1. The 1st code was this, it works but I would like to append and add to it

JavaScript

Advertisement

Answer

The description looks mixed in. However if you are looking for why the button is not working for the “tkform”, then you need to change the id of the “tkform” either in the call to action functions:

JavaScript

or

in the form HTML description

JavaScript

“tkform” & “tkForm” are two different IDs.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement