title: Is it possible to wrap an if statement around javascript `.click` function?
body: <p>I am running into trouble whenever I wrap javascript <code>.click</code> function into an if statement like </p>
  
  <pre><code>$(document).ready(function(){
      var test = "something";
      if (test == "something"){
          $("#" + test).click(function(){
              do_something();
          });
      }
  });
  </code></pre>
  
  <p>What happens is that the <code>.click</code> doesn't do the binding as compared to not wrapping around an if statment. Is this an expected behavior?</p>
  
  <p>Edit: element <code>"#" + test</code> has a possibility of not existing, that's why I have the outer condition</p>