Saturday, April 30, 2011

How to always reference latest version of jQuery

As you are aware that already many version of jQuery is released and the latest version is 1.5.2. And jQuery 1.6 is around the corner. When you are referencing the jQuery from CDN then you need to specify the version number as well so that version gets loaded.
<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js">
</script>
Above code will load jQuery 1.5.1 from Google CDN. But it would be nice if always latest version is referred irrespective of new version is released and you don't have to modify the jQuery referencing code.

Well,jQuery.com is also one of the CDN where jQuery is hosted. You can always refer to the latest version of jQuery.
<script type="text/javascript"
src="http://code.jquery.com/jquery-latest.min.js" charset="utf-8">
</script>
This will always load the latest version of jQuery. Currently it refers to 1.5.2 and in future if 1.6 is released then it will load 1.6. Cool...

Feel free to contact me for any help related to jQuery, I will gladly help you.