Becky Becky - 1 year ago 58
HTML Question

Initiating a function if text equals a specific value

I am having a difficult time figuring out why my code is not working. What I am trying to do is make somewhat of a sequence. The user goes to this page and has to type in "Let me in". Then once they type that into the input, I have a

function checking for it, then I want to initiate the welcome function in a
format to display the
div. Then 500ms later display my register function with a
of 2000ms.

Right now, nothing is initiating. I am getting one error, though I am unsure what I did wrong with it.

VM60:1 Uncaught SyntaxError: Unexpected identifier

[object HTMLDivElement]

Here is a fiddle to see my code

What am I doing wrong and is there a better way to do this?

Answer Source

Your first problem is when you call setTimeout you pass it "welcome", but the name of your function is "greeting". The second problem is your css rule for making the divs invisible are more specific than the active class that will make it visible again causing the active rules to be ignored. A simple fix is to make your active rule more specific like below:, {
    visibility: visible;
    opacity: 1;