title: Select partial ID name in javascript
body: <p>I have an asp.net webform where I include the following script (on a separate .js file):</p>
  
  <pre><code>function pageLoad() {
      var mpe = $find("mpeEmpresa");
      mpe.add_shown(onShown);
      $addHandler(document, "keydown", onKeyDown);
  }
  function onShown() {
      var background = $find("mpeEmpresa")._backgroundElement;
      background.onclick = function() {
      $find("mpeEmpresa").hide();
      }
  }
  </code></pre>
  
  <p>Unfortunately, it won't work because asp.net 3.5 changes the elements id's. The only way I could get it to work is to use <code>ctl00_ContentPlaceHolder1_empresaFilha_mpeEmpresa</code> as the ID.</p>
  
  <p>Sure I could use <code>&lt;%= mpeEmpresa.ClientID %&gt;</code> from the asp.net side, it would work but I'll have to pass that as a var to my external .js file and it's not exactly what I'm trying to accomplish.</p>
  
  <p>I have searched on a few ways to select the element by it's ID name partially, but couldn't get any of them to work... Is there a guaranteed way?</p>