title: Jquery get dynamically generated Id of control
body: <p>I have a page where Ids are changed to <code>ctl00_MainContent_txt_insurance</code>. In this case I cannot use the actual Id as <code>$("#txt_insurance")</code>. so what I did was to use <code>$("#&lt;%= txt_insurance.ClientID %&gt;")</code>, which works fine now.</p>
  
  <p>But now if I want to replace the above ID and show it I did this:</p>
  
  <pre><code>divToChangeVisible = $("#&lt;%= txt_insurance.ClientID %&gt;");
  divToChangeVisible.replace("txt_", "val_").show();
  </code></pre>
  
  <p>This will get me an object and throws an error saying cannot be replaced. Is there a way to get <code>txt_insurance</code> as Id without having to replace <code>ctl00_MainContent_</code>?</p>
  
  <p><em><strong>Edit ::</em></strong> If I do <code>$("#&lt;%= txt_insurance.ClientID %&gt;").attr('id')</code> this will again return the dynamic id...</p>