title: How to select JSF components using jQuery?
body: <p>I am trying to implement jQuery with PrimeFaces and JSF components, but it's not working properly. When I tried to do the same with HTML tags it;s working properly.</p>
  
  <p>Here is the code with HTML tags which works properly with jQuery:</p>
  
  <pre><code>&lt;input type="checkbox" id="check2"&gt;&lt;/input&gt;
  &lt;h:outputText value="Check the box, if your permanent address is as same as current address."&gt;&lt;/h:outputText&gt; 
  &lt;h:message for="checkbox" style="color:red" /&gt;
  </code></pre>
  
  <p>with</p>
  
  <pre><code>$("#check2").change(function() {
      if ($("#check2").is(":checked")) {
          $("#p2").hide();
      } else {
          $("#p2").show();
      }
  });
  </code></pre>
  
  <p>Here is the code with PrimeFaces/JSF which doesn't work properly with jQuery:</p>
  
  <pre><code>&lt;p:selectManyCheckbox &gt;
      &lt;f:selectItem itemLabel="1" value="one" id="rad" &gt;&lt;/f:selectItem&gt;
  &lt;/p:selectManyCheckbox&gt;
  </code></pre>
  
  <p>with</p>
  
  <pre><code>$("#rad").change(function() {
      if ($("#rad:checked").val() == "one") {
          $("#p2").hide();
      } else {
          $("#p2").show();
      }  
  });
  </code></pre>