title: Trigger onclick event of an anchor tag on document onload
body: <p>I have built a custom plugin in Wordpress. Its basically a Customer Feedback form which pops up when you are at the home page.</p>
  
  <p>Presently when I install this plugin, it creates a anchor link in the footer. This was just for testing purposes.</p>
  
  <p>When I click on the anchor link that is generated in the footer, it opens up my customer feedback in a custom pop-up that I created using Jquery and CSS. </p>
  
  <p>But I want to load the pop-up when my page is loaded and not clicking on anchor link. </p>
  
  <p>For that I used jQuery trigger function to call the Click event of that anchor on document load.</p>
  
  <pre><code>But its not working. Here is my code below :
  
  **jQuery code**
  
  jQuery(document).ready(function() {
      //alert('hi');
      jQuery('a.static_button').trigger('click');
  
      function alert_popup(){
          alert('yo yo yo .....you good to go.!!!');
      }
  
      jQuery('a.static_button').click(function() {
              loading(); // loading
              setTimeout(function(){ // then show popup, deley in .5 second
                  loadPopup(); // function show popup
              }, 500); // .5 second
      return false;
      });
  });
  </code></pre>
  
  <p>Code from my <strong>plugin file</strong> </p>
  
  <pre><code>&lt;?php
  function myscript(){
    wp_enqueue_script('light');
    wp_enqueue_style('stylesheet');
  ?&gt;
      &lt;a href="#" id="go-to-top" onclick="javascript:alert_popup();"  class="static_button topopup"&gt;Click here&lt;/a&gt;
      &lt;!-- PopUp Div goes here --&gt;
       &lt;div class="loader"&gt;&lt;/div&gt;
        &lt;div id="backgroundPopup"&gt;&lt;/div&gt;
        &lt;div id="toPopup"&gt;
            &lt;div class="close"&gt;X&lt;/div&gt;
                &lt;div id="popup_content"&gt; &lt;!--your content start--&gt;
                  &lt;div class="contact_form"&gt;
                      &lt;form&gt;
                          &lt;?php echo do_shortcode('[cust]');?&gt;
                        &lt;/form&gt;
                    &lt;/div&gt;
                &lt;/div&gt;
           &lt;/div&gt;
        &lt;!-- PopUp Div ends here --&gt;
  &lt;?php
  }
  ?&gt;
  </code></pre>