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>
# include <iostream>
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!!