title: How to call dynamic id in jquery selector
body: <p>I'm generating radio inputs with a custom <code>id</code> like this:</p>
  
  <pre><code>foreach($paymentMethods['CustomPayment'] as $custompay) {
      $html .= '&lt;input type="radio" id="cnp_payment_method_selection_'.$custompay.'" name="cnp_payment_method_selection" class="cnp_payment_method_selection" style="margin: 0 0 0 0;" value="'.$custompay.'"&gt;&amp;nbsp;&lt;b&gt;'.$custompay.'&lt;/b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;';
  }
  </code></pre>
  
  <p>I am using the same id below in the jQuery selector but when it's dynamic it's not working:</p>
  
  <pre><code>jQuery("#cnp_payment_method_selection_customay").click(function() {
      jQuery("#cnp_CreditCard_div").hide();                   
      jQuery("#cnp_eCheck_div").hide();
      jQuery("#cnp_Custompay_div").show();
  });
  </code></pre>
  
  <p>How can I call the that dynamic id in that selector?</p>
  
  <p>In  $custompay we will get some thing like this <strong>custom,custom1,custom2</strong> based on that id should be <strong>cnp_payment_method_selection_customay,cnp_payment_method_selection_customay1,cnp_payment_method_selection_customay2</strong></p>
  
  <p>by using below code </p>
  
  <pre><code>foreach($paymentMethods['CustomPayment'] as $custompay) {
                  $html .='&lt;script type="text/javascript"&gt;
                          var simple = "cnp_payment_method_selection_'.$custompay.'";
                          alert(simple);
  
                          &lt;/script&gt;'; 
  
                      //print_r($custompayment);
                  $html .= '&lt;input type="radio" id="cnp_payment_method_selection_'.$custompay.'" name="cnp_payment_method_selection" class="cnp_payment_method_selection" style="margin: 0 0 0 0;" value="'.$custompay.'"&gt;&amp;nbsp;&lt;b&gt;'.$custompay.'&lt;/b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;';
  
                  }
                  $html .= '&lt;/span&gt;';
  </code></pre>
  
  <p>Where my var simple is getting Id which i want but now i want pass that variable in the place of <code>&lt;input type="radio" id="cnp_payment_method_selection_'.$custompay.'" name="cnp_payment_method_selection" class="cnp_payment_method_selection" style="margin: 0 0 0 0;" value="'.$custompay.'"&gt;</code></p>
  
  <p>variable i want to call place of id as variable </p>