Page 1 of 1

Trouble with JavaScript

Posted: Mon Mar 11, 2013 5:05 pm
by Matt Oakes

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


Trouble with JavaScript

Posted: Mon Mar 11, 2013 5:26 pm
by Kateryna Grynko

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


Trouble with JavaScript

Posted: Mon Mar 11, 2013 5:31 pm
by Matt Oakes

That works!

You're ace :-)

Thanks!