Step 1. Create the myfile.js file with the contents:
$(document).ready( function() {
Step 2. On your HTML page, first enable jQuery, then enable myfile.js (in that order).
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"></script> <script type="text/javascript" src="myfile.js"></script>
Step 3. PROFIT!
Step 4. (OPTIONAL) . Modify myfile.js using http://jscompress.com/ or something else minifier you want to use.
source share