top of page

Webmaster Help

Using code to hide buttons

Using code to hide buttons

How can I show or hide a button based on whether or not it has a link?

Show me

I use code to hide things. I don’t want someone to go to a gallery that doesn’t exist. This code: if(!$item('#handout').link){$item("#handout").hide();} says if NOT a link associated with the handout button (that is, there’s no handout in the collection), then HIDE the button called handout. The ‘!’ means ‘not’ in the code. (I use this A LOT). $ITEM refers to an item on the page, in this case the button known as “handout.” In some cases, I had to cheat to get it to work. So, you will see some hidden text—which is how I’m checking to see if there is anything in that database field, and then hiding the button if there is none.

bottom of page