Easy Steps for Embedding JQuery-code into your HTML-code September 1, 2011Posted by Tournas Dimitrios in JQuery.
These instructions are to help all jQuery newbies out there who might want to use jQuery for the first time and are wondering “how do I set jQuery up ?”. Well there are a two different ways to do this .The first way is to self host your jQuery package on your host account . Just download the latest release of the JQuery package from the official website , Save the content in a folder called “js” and upload the folder into your host . There are 2 versions of jQuery : a minified version and a source version . I recommend that you use the minified version as it’s smaller in size and will make your web page load faster. The main difference between these two version is that the jQuery source version is human readable for you to check how the various jQuery functions are put together .
- Between the html
< h ead> < / head>tags write the following code :
- The second way is to load your jQuery package “on the fly” . A number of large enterprises provide hosted copies of jQuery on existing CDN networks that are available for public use. Three leaders in the Internet industry provide CDN-hosted copies of jQuery that you may hotlink to . The code in the HTML page will reference the library as follows :
If you want an event to work on your page, you should call it inside the $(document).ready() function . Everything inside it will load as soon as the DOM is loaded and before the page contents are loaded . Just before the closing < / b ody> tag write the following code :