Pagebeforecreate fires twice?

Pagebeforecreate fires twice?

I´m hooking up my buttons with this code:

  1. $( '#startpage' ).live( 'pagebeforecreate',function()
  2. {
  3.     console.log('pagebeforecreate started');
  4.     console.log('hook btns');
  5.    
  6.     $("#info").on('tap',function()
  7.     {
  8.             $.mobile.changePage('pages/info/info.html');
  9.             return false;
  10.    
  11.      });
Problem is that is seems to fire twice and that is a problem (since i "hook" up the buttons).

I also have this on the page and i think that the $.mobile.ChangePage will make the event fire off twice for some reason:

  1. $( '#startpage' ).live( 'pageshow',function(event,ui)
    {      
  2.      $.ajaxSetup({timeout:20000});
        setVar("set_somevar",10,true);

  3.     if (isLogedIn)
        {
            $('#startcontent').show();
            $('#startpageheader').show();
        }
        else
        {
            $.mobile.changePage('pages/login/login.html',{ changeHash: false});
        }
        

    });











How can i make the script to only "hook" buttons once? Why does the pagebeforecreate fire off twice?