ExecuteOrDelayUntilScriptLoaded(func, depScriptFileName)
or
SP.SOD.executeOrDelayUntilScriptLoaded(func, depScriptFileName)
<script type="text/javascript"> ExecuteOrDelayUntilScriptLoaded(function() { alert('sp.js loaded'); }, 'sp.js'); SP.SOD.executeOrDelayUntilScriptLoaded(function() { alert('jquery.js loaded'); }, 'jquery.js'); </script>