Question: Im stuck, Im setting a variable when someone clicks, then testing with if to see if the variable exists and doing something else. Its a simple script which Im probably overthinking, would love someone's thoughts.

```
  $('.view-alternatives-btn').live('click', function() {

//$("#nc-alternate-wines").scrollTo();
   //$('.nc-remove').toggle();
   var showBtn = null;
   if (showBtn == null) {
   $('.view-alternatives-btn img').attr("src","../images/wsj_hide_alternatives_btn.gif");
   $('#nc-alternate-wines').show();
   showBtn = 1;
   console.log(showBtn);
   }
   else if (showBtn == 1) {
   $('.view-alternatives-btn img').attr("src","../images/wsj_view_alternatives_btn.gif");
   $('#nc-alternate-wines').hide();
   console.log("this " + showBtn);
   }
   return false; 
  });

```

Answer: 
`showBtn` is a local variable, so its value is not persisted across `click` events.

Move `var showBtn = null;` outside the `click` handler.

However, the best way to do this is to call jQuery's [`toggle` method](http://api.jquery.com/toggle). (Except that `toggle` cannot be used with `live`)
Awesome, thanks for the help everyone!

I got it working!

```
  var showBtn = 1;

  $('.view-alternatives-btn').live('click', function() {

     //$("#nc-alternate-wines").scrollTo();
     //$('.nc-remove').toggle();

   if (showBtn == 1) {
       $('.view-alternatives-btn img').attr("src","../images/wsj_hide_alternatives_btn.gif");
       $('#nc-alternate-wines').show();
       showBtn = 0;
       console.log(showBtn);
   }
   else {
       $('.view-alternatives-btn img').attr("src","../images/wsj_view_alternatives_btn.gif");
       $('#nc-alternate-wines').hide();
       console.log("this " + showBtn);
       showBtn = 1;
   }
   return false; 
  });

```