title: run button's click on page load
body: <p>i have a input like this "</p>
  
  <pre><code>&lt;input type='button' name='osx' value='Demo' class='osx demo' runat="server" /&gt;
  </code></pre>
  
  <p>that when i click on this , it runs a jQuery plugin.
  now i want to call this input's click event on my page load, in fact i want to run it's plugin at page load, so i use this code :</p>
  
  <pre><code>&lt;script&gt;
      $("document").ready(function () {
          window.getElementById("osx").click();
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>but when i run my page , i get this error :</p>
  
  <blockquote>
    <p>Line: 16
    Error: Object doesn't support property or method 'getElementById'</p>
  </blockquote>
  
  <h2>can enyone help me ,please?</h2>
  
  <p>i done all of your answers but non of them worked for me!!!
  here in my page's code :</p>
  
  <pre><code>&lt;%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %&gt;
  
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head runat="server"&gt;
      &lt;title&gt;&lt;/title&gt;
      &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"&gt;&lt;/script&gt;
      &lt;link type='text/css' href='css/osx.css' rel='stylesheet' media='screen' /&gt;
      &lt;script&gt;
         $("document").ready(function () {
     document.getElementById("osx").click();
  }
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;div id='container'&gt;
          &lt;div id='content'&gt;
              &lt;div id='osx-modal'&gt;
                  &lt;input id='osx' type='button' name='osx' value='Demo' class='osx demo' runat="server" /&gt;
                  or &lt;a href='#' class='osx'&gt;Demo&lt;/a&gt;
              &lt;/div&gt;
              &lt;!-- modal content --&gt;
              &lt;div id="osx-modal-content"&gt;
                  &lt;div id="osx-modal-title" dir="rtl"&gt;
                      OSX Style Modal Dialog&lt;/div&gt;
                  &lt;div class="close"&gt;
                      &lt;a href="#" class="simplemodal-close"&gt;x&lt;/a&gt;&lt;/div&gt;
                  &lt;div id="osx-modal-data"&gt;
                      &lt;h2&gt;
                          Hello! I'm SimpleModal!&lt;/h2&gt;
                      &lt;p&gt;
                          SimpleModal is a lightweight jQuery Plugin which provides a powerful interface for
                          modal dialog development. Think of it as a modal dialog framework.&lt;/p&gt;
                      &lt;p&gt;
                          SimpleModal gives you the flexibility to build whatever you can envision, while
                          shielding you from related cross-browser issues inherent with UI development..&lt;/p&gt;
                      &lt;p&gt;
                          As you can see by this example, SimpleModal can be easily configured to behave like
                          an OSX dialog. With a handful options, 2 custom callbacks and some styling, you
                          have a visually appealing dialog that is ready to use!&lt;/p&gt;
                      &lt;p&gt;
                          &lt;button class="simplemodal-close"&gt;
                              Close&lt;/button&gt;
                          &lt;span&gt;(or press ESC or click the overlay)&lt;/span&gt;&lt;/p&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
      &lt;script type='text/javascript' src='js/jquery.simplemodal.js'&gt;&lt;/script&gt;
      &lt;script type='text/javascript' src='js/osx.js'&gt;&lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>where am i do wrong?</p>