We can separate custom code in the separate custom java script file. In this example ,we put the jQuery script in a separate file , which will save with ".js" extension. This ".js" file have all the jQuery scripting.
How to use the separate js file in HTML page?
You should create a separate js file and use the following code to include it in the HTML page:
So, this is good and easy best practices of using the .js file in HTML page. In this example we have jQuery code in a different js file which we are including in our main HTML page and its working fine.
We can include "custom.js" file as :
Posted on: July 24, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles