Expand my Community achievements bar.

SOLVED

One button -- show and hide function

Avatar

Level 4

Hi I want the use to be able to click the button once to show a subfield and click again to hide it

I have the code on the click event and the click to show step  works but the second click to hide does nothing

my code is :

if(help1vidlist.presence = "hidden") {

help1vidlist.presence = "visible";

} else if (help1vidlist.presence = "visible"){

help1vidlist.presence = "hidden";

}

any ideas?

thank you

1 Accepted Solution

Avatar

Correct answer by
Level 10

I think you need to use the "==" operator in the conditions, that is;

if(help1vidlist.presence == "hidden") {

help1vidlist.presence = "visible";

} else if (help1vidlist.presence == "visible"){

help1vidlist.presence = "hidden";

}

Regards

Bruce

View solution in original post

2 Replies

Avatar

Correct answer by
Level 10

I think you need to use the "==" operator in the conditions, that is;

if(help1vidlist.presence == "hidden") {

help1vidlist.presence = "visible";

} else if (help1vidlist.presence == "visible"){

help1vidlist.presence = "hidden";

}

Regards

Bruce

Avatar

Level 4

Thanks Bruce,

perfect.......

i always make a mess of the "=" and "=="

much appreciated