Matt Oakes
Posts: 0
Joined: Fri Mar 01, 2013 12:45 pm

Trouble with JavaScript

Hi,

I'm struggling to do a simple job with JavaScript. I've looked online for answers but with no luck. I have managed to create an input with a button that assigns whatever the user enters to a variable called "Answer". I now need a couple of lines that will compare this to a predetermined answer and, if they match, unhide a label called "Output".

So far, I think this should work (assuming the correct answer is James Bond)

if (localStorage.getItem('Answer') == 'James Bond')

How is the unhiding of the Output label then done?

Thanks for any help you can give me!

Matt

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Trouble with JavaScript

Hi Matt,

You can access components by their names or IDs.

If component name is "component" you can use the following code to hide/show component:codeTiggzi('component').hide();
Tiggzi('component').show(); /code
If component ID is "component" use: code$('#component').hide();
$('#component').show();/code

Matt Oakes
Posts: 0
Joined: Fri Mar 01, 2013 12:45 pm

Trouble with JavaScript

That works!

You're ace :-)

Thanks!

Return to “Issues”