title: JavaScript getElementById for ASP.NET Control returns null?
body: <p>I use JavaScript and this error appears for me during execution:</p>
  
  <pre><code>Microsoft JScript runtime error: 'document.getElementById(...)' is null or not an object
  </code></pre>
  
  <p>this my code:</p>
  
  <pre><code>&lt;asp:Content ID="content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server"&gt;
  &lt;script language="javascript" type="text/javascript"&gt;
      function ConfirmTransfere() {
          if (confirm("Syatem not allow negative inventory, would you like to continue ?") == true) {
              document.getElementById("btnAlelrt").click();
  
          }       
  }
  &lt;/script&gt;
  &lt;asp:ScriptManager ID="ScriptManager1" runat="server"&gt;
      &lt;/asp:ScriptManager&gt;
      &lt;asp:UpdatePanel ID="uxContainer" runat="server"&gt;
      &lt;ContentTemplate&gt;
   &lt;table&gt; 
  &lt;tr&gt;
          &lt;td&gt;
          &lt;asp:Button ID="uxTransfer" runat="server" Text="Transfer" OnClick="uxTransfer_Click" /&gt; 
          &lt;asp:Button ID="btnAlelrt" runat="server" Text="GetDetails" OnClick="btnAlelrt_Click" /&gt;       
          &lt;/td&gt;
          &lt;/tr&gt;
  &lt;/table&gt;
      &lt;/ContentTemplate&gt;
  &lt;Triggers&gt;
      &lt;asp:PostBackTrigger ControlID="uxTransfer" /&gt;    
      &lt;/Triggers&gt;
      &lt;/asp:UpdatePanel&gt;
  
   &lt;/asp:Content&gt;
  </code></pre>