jQuery is a Javascript library that focuses on the interconnected operation of HTML, JavaScript, and CSS technologies.
What jQuery is capable of
The library can work with the following list of tasks:
- able to perform access to absolutely any element of the page object model (DOM) and perform complex manipulations with them;
- event handling is supported;
- there is functionality for various graphic effects and animations;
- Simplified work with AJAX dynamic boot technology (the function is very important and extremely useful, but not about that now);
- jQuery has its own plugins in huge numbers, the main function of which is to implement user graphical interfaces and user interaction with them.
Compressed and uncompressed versions of the library
Several script options are available to developers - one is compressed, the other is not. A full version is very convenient to use at the stage of coding and debugging (testing) of web applications. The minimalized version, on the contrary, will have few useful advantages during debugging, but it loads many times faster and takes up less space. Thus, it is advisable to use the compressed version of jQuery already in the finished project, because it saves server traffic and disk space.
How to choose jQuery version correctly
Today there are several main directions in jQuery - these are version 1.x, 2.x, and 3.x branches. Their striking difference is that, starting from the second version, any support for outdated browsers, such as the browser from Microsoft - Internet Explorer, was terminated, up to and including the eighth version.
This solution allowed us to reduce the physical volume of data in the library by ten percent and slightly optimize its work. Nevertheless, there are still home and corporate computers in the world where the old Internet Explorer is installed as the main browser, even though the percentage of these users does not exceed 3% all over the world. Therefore, whether or not to support an outdated platform is up to you.
JQuery developers adhere to the principles of backward compatibility of versions. This means that code written for library version 1.7 will also work with version 1.8. But sometimes the development company removes little-useful functions from jQuery, so it is better to re-read the documentation for the new version if you are going to upgrade.
In 2016, a new jQuery branch was released. It was version 3.0, which became even faster and lighter than older versions. Hacks were finally removed from it to implement some functions in outdated browsers, which made it possible to position the library as a modern and powerful development tool.
If your project is already tied to some library, then first estimate the labor costs of the upgrade. If the benefits received from the new version will be worth it - feel free to start work. All developers who are just starting to use the tool in their projects, it is advisable to start directly with the latest versions.
How to get started with jQuery
The first step is to make a jQuery connection. To do this, you need to directly download the library from the jquery.com developer resource, or from the mirror, and place the library on your web server.
Now let's do the jQuery connection to the web page itself. The script tag is involved in connecting various scripts in the hypertext markup language. Let's connect jQuery using the following code:
This option is well suited for connecting offline, but there are many other ways for server use.
Connect jQuery using cloud services
Google provides the Hosted Libraries service, using which anyone can connect a popular framework or library to their web application. To connect jQuery through Google Cloud Storage, use the line that corresponds to the selected version in the following diagram:
The numbers in the versions column correspond to the version number, which is available for installation and further work with it. To connect any of the intermediate versions, just copy its numeric number into the connection string instead of the numbers indicated in the example.
You can always view the list of current versions at:
https://developers.google.com/speed/libraries/#jquery
If for some reason you do not trust Google, but still want to know how to connect the jQuery library from a third-party reliable server, use the Microsoft repository.
jQuery is one of the best tools for easily creating animations on web pages. After you realize the power of this tool, you will be very glad that you began to study such a library.
Skeptics among students and developers believe that it is better to implement everything with a pure programming language, without using third-party libraries. But you need to understand that the jQuery file takes only thirty two kilobytes, and most likely is already in your user's browser cache if you connect the script via Google. So don't be afraid to learn tools that make life easier for the developer. Indeed, for this we are connecting the jQuery library - so as not to reinvent the wheel.