Showing posts with label toggle. Show all posts
Showing posts with label toggle. Show all posts

Wednesday, May 30, 2012

Is there a better way of writing v = (v == 0 ? 1 : 0);


I want to toggle a variable between 0 and 1. If it's 0 I want to set it to 1, else if it's 1 I want to set it to 0.

Thursday, May 24, 2012

How do you test if something is hidden with jQuery?


In jQuery, suppose you have an element of some kind that you're hiding and showing, using .hide() , .show() or .toggle() . How do you test to see if that element is currently hidden or visible on the screen?