DOM loaded after function executes

DOM loaded after function executes

Hi,

I'm developing one jQuery Mobile web site. In this site, I've kept html files and js files separate. So, whenever user clicks on a link corresponding html page is loaded and js is executed. However, I've noticed that, sometimes, function executes before DOM is loaded and thus I can't get desired and predictable output.
Any solution for this?

Thanks.