title: Jquery, getting 'this' selector from a conditional
body: <p>I have several elements on my page with the 'checkbox' class.  When clicked, a corresponding checkbox input is checked.  However, I need to have JQuery check if the checkbox element is active when the page first loads, and check the checkbox input accordingly at that time.</p>
  
  <p>Since there are multiple 'checkbox' classes on my page, I used the 'this' selector previously and it worked fine, however I do not know how to make it do this with my conditional on page load without the .click action that I used before.  Here's what I'm trying to make work:</p>
  
  <pre><code>if($('.checkbox').hasClass('active')) {
      $('[name="'+$(this).attr('rel')+'"]').prop('checked', true); 
  }
  </code></pre>
  
  <p>Obviously the 'this' selector doesn't know what I'm referring to.  Is there a better way of doing this?  Since it's checking through a bunch of elements and not just one I'm stumped.  Thanks!</p>