title: How to use scriptlet based id in jQuery selectors
body: <p>I have to use dynamic ids in my form, based on jsp variables in a scriptlet. How can I select the correct element using jQuery's id selector without getting errors?</p>
  
  <p>Here's my code:</p>
  
  <pre><code>&lt;form name="intakeOnly" id="intakeOnly_&lt;%=complaint%&gt;" method="post" action="../Intake.do"&gt;
  &lt;table class="normal"&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;b&gt;Clinician Signature: &lt;/b&gt; &lt;span id="cSigI_&lt;%=complaint%&gt;"&gt;&lt;%=clinicianSig%&gt;,&lt;%=signedDate%&gt;&lt;/span&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;input type="button" id="submitSig_&lt;%=complaint%&gt;" name="submitSig" value="Sign and Save" onClick="intakeSubmit();"&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/table&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Javascript:</p>
  
  <pre><code>function intakeSubmit() {
     var complaint = &lt;%=complaint%&gt;;
     var fname = new String("&lt;%=userFirstName%&gt;");
     var lname = new String("&lt;%=userLastName%&gt;");
     var date = new String("&lt;%=DateUtils.getDate()%&gt;");
     jQuery("#cSigI_"+complaint).append("&lt;br&gt;"+fname+" "+lname + ","+ date); 
  }
  </code></pre>