Map and Autocomplete only work after refresh

Map and Autocomplete only work after refresh


I just started using jQuermobile and I ran into a problem.

My project consist of four pages, all loaded into the index.php via GET...

The first page inclues a OpenLayers Map, which doesn't work initially, when the page is loaded. Only after I refresh the browser once, it loads and displays perfectly.

A similar effect prevails with an autocomplete form that is included in the top of every page. Upon initial page loading, you can type in the field, but autocomplete won't work. Only after refreshing the page, it works, but only on the page that was refreshed. If I navigate to another page, where the same form is implemented, it won't work until refreshed.

Since the map and autocomplete form are the only two js item on the page and both don't work, I expect the issues to have something to do with jquery. I followed the suggestion to load scrips in the body tag (not in the head), but that doesn't work either.

Any suggestions?