Trigger button event on page load

Trigger button event on page load


I am trying to trigger a button on on the load of a page.
It's a JQuery button with the html code in the page as:

<a  href="" class="btn1"></a>

So far I've tried :

  1. <script>
    $(document).ready(function(){
      $('.btn1').trigger('click');
    });
    </script>




But that doesn't do the job.
What should I use to make this work?

Thanks a lot.
John