title: How do I get Jquery to compare between two selectors?
body: <p>I think my JQuery knowledge is a little lacking.</p>
  
  <p>On my page I have 0 or more hidden variables that look like this.</p>
  
  <pre><code>&lt;input type='hidden' class='defaultTickedStatus' value='INACTIVE' /&gt;
  &lt;input type='hidden' class='defaultTickedStatus' value='ACTIVE' /&gt;
  </code></pre>
  
  <p>They can be accessed via the selector $(".defaultTickedStatus")</p>
  
  <p>I also have a number of checkboxes in an element like this </p>
  
  <pre><code>&lt;div id="checkboxes"&gt;
  &lt;input type="checkbox" value="INACTIVE" id="checkbox1" tabindex="30430"&gt;
  &lt;input type="checkbox" value="ACTIVE" id="checkbox1" tabindex="30430"&gt;
  &lt;input type="checkbox" value="SUBMITTED" id="checkbox1" tabindex="30430"&gt;
  &lt;input type="checkbox" value="FINALISED" id="checkbox1" tabindex="30430"&gt;
  ...
  &lt;/div&gt;
  </code></pre>
  
  <p>They can be accessed via the selector $("#checkboxes input")</p>
  
  <p>What I would like to do is when the user clicks a button, I want it go through all of the checkboxes and for the ones that have a value which equals one of the values in the hidden tags, then to check it.</p>
  
  <p>However, being a little unfamiliar with JQuery, I'm unfamiliar with how to accomplish this. This is what I have so far...</p>
  
  <pre><code>    $("#checkboxes input").each(function (index, Element)
      {
          $(".defaultTickedStatus").each(function (i2, status)
          {
              if (status.value == Element.value)
              {
                  $(status).selected(true);
              }
  
          });
  
      });
  </code></pre>
  
  <p>It's getting to the $(status).selected(true) part but for some reason, it does not seem to work. Also, I'm positive there is a much easier way to do this through Jquery.</p>
  
  <p>Wonder if anyone can help me.</p>
  
  <p>Thanks</p>