There is nothing wrong with the code, but if the js is not running on the ready event of the document then make sure it appears after the button on the page.
<asp:Button ID="Button2" onclick="btn2_click" runat="server" />
<script type="text/javascript">
$("#<%= Button2.ClientID %>").trigger("click");
</script>
If it still "doesn't work" then the problem lies elsewhere with something you haven't shown and you'll need to do some debugging to find out what it isn't working.