Javascript not executing on window.onload when page first loads, but does after a page refresh

Javascript not executing on window.onload when page first loads, but does after a page refresh

I'm pretty new to JQuery and think I have a fundamental misunderstanding of how JQuery mobile works. I'm learning as I go, so I'm not necessarily looking for a specific answer, but a direction to go find it on my own.

I am writing some javascript functions with PHP at the server. When the page loads, there is a window.onload command that runs one of the functions. Contrary to what I'm thinking should happen, it doesn't. The script is written at the server then served to the browser. At which time the browser loads the page and executed the window.onload event. Apparently that is not happening and I think it may have something to do with how JQuery mobile loads pages. If I refresh the page after it loads, everything works fine, so I know it's not the JS.

You can see it what I mean by going to http://testing.itlogic.org/pokernola. Once there click on the "games" button. You will have to log in, so click on the lock on the bottom right corner. Use van@pokernola.com and van as the password.

Click on the edit button on the first item in the split list. When you get there you see a check box with a slider under it. When the page loads, that slider is supposed to be disabled and the check box turns it on and off, but that doesn't happen. If you do a page refresh after the page loads, it all works as it should.

How is the page loading in JQuery Mobile so that the window.onload event isn't firing after the page loads for the first time, but does after the refresh?