I have content that has the option of being filtered, which depends on the state of a global variable. I wish to have a button that toggles the state of the variable between two modes: on and off. The content is inside a class, which has a function to print out the content (function has conditional statements to output differently if filter is on).
I am not getting expected results though. The variable first starts out as being empty and if it is either empty or false, the button (when clicked) would toggle the filter to on. If the variable is true, it would (when clicked) toggle the filter to off.
Ideas on why global varible isn't behaving correctly? Thanks!
(If this doesn't make sense, think of a button to toggle, say, a printable-version state)