JQuery CDN Issue


Every programming language or a script requires a library in order  for the developer to experience all the the functions and features of the language. A library is a resource which has got lot of useful and important information which allows programs to execute properly.  All major programming languages require you to include the libraries before writing the program.

For Example in the C language-

# include <stdio.h>


In C++


# include <iostream>


JQuery (which itself is a library of the Javascript programming language) also requires a library in order for the JQuery code to function in the web browser. It can be either downloaded from the Internet or we can specify a url which would access that resource (CDN). Google is one of the hosting providers which hosts  JQuery libraries.

While working with JQuery you might have observed that sometimes the CDN fails to load. You might have used the latest JQuery CDN but still it does not work.

The main reason it does not work is because the JQuery file is linked before we place the JQuery CDN in the header section of the html file.

Something like this-

We are taking an Instance where we are using the JQuery libraries hosted by google and assuming that the JQuery file we have written is named as “script.js”

In the HTML File,





Which is wrong.


This would be the solution in order to avoid this problem.


1.First place the JQuery CDN on the header section of the HTML file

2. Then use the script tag to link to your JQuery File.



And it works!!


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s