title: JQuery if class is active if statement
body: <p>I am working on this at the moment but it's not fully working, it might be the else statements?
  Basically, if .grey-square is active then set a value to a hidden input field to 'true', if it's not active/unhidden in the code, set the value to nothing.
  I have loads of q's so therefore the long list but I am unsure this is correct?</p>
  
  <pre><code>&lt;input type="text" class="answerStored hidden" name="q1" id="q1"&gt;
  
  &lt;script&gt;
  $(function() {
  $('.one').bind('click', function() {
      if($(this).hasClass('grey-square')) {
          $("#q1").attr("value", true);
      }
      else {
          $("#q1").attr("value", '');
      }
  });
  $('.two').bind('click', function() {
      if($(this).hasClass('grey-square')) {
          $("#q2").attr("value", true);
      }
      else {
          $("#q2").attr("value", '');
      }
  });
  $('.three').bind('click', function() {
      if($(this).hasClass('grey-square')) {
          $("#q3").attr("value", true);
      }
      else {
          $("#q3").attr("value", '');
      }
  });
  });
  &lt;/script&gt;
  </code></pre>