Jquery is a javascript library which is used a javascript function to make easier tasks and lightweight with less code. In the modern world webpage mostly uses javascript for interactive and dynamic data interaction with the webpage sections.
Jquery is a small javascript library that is a single js file. It provides many types of build-in functions to make javascript usage the easiest way in the web pages.
Jquery can use in two ways:-
- Local Installation
In this way, you can download the jquery file in the project directory and call in the webpage head section using the script tag. - CDN based
In this way, you use the jquery CDN as a URL same as local but it is based on the CDN provider URL included in the script tag of the Html webpage.
When can use Jquery in Your Web Page:-
- Jquery is used when you want to make ajax based applications.
- It can make simple concise and reusable code of javascript.
- It simplified the traversal of Html dom.
- It can handle events on the Html dom like click, mouse events, etc.
- It can perform Html dom update modify and create dynamically.
Use of Jquery in Html:-
You can use jquery in the html head section using script tag with jquery file local hosted path or using cdn url like this:-
<html> <head> <!-- head content --> <script type='text/javascript' src='local/path/jquery.js'></script> <!-- OR --> <script type='text/javascript' src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js'></script> </head> <body> <!-- body content --> </body> </html>
the above code is to initailze jquery and its function for the usase in hte html codes.
Some important usase of the jquery library:-
- Plugins:-
Some javascript plugins usase jquery as dependancy of the function of jquery pre build function inside plugins, then if you are usas that plugin you should use jquery otherwise plugins not working in the webpages. Like slider plugins, validations, calender etc. - Webpage structure manipulations:-
In this you can modified predefined html structure after page loaded in the browsers, and change styles, and create new elements dynamically. - Animations and Ajax:-
You can animate you webpage content using jquery animation function or setting some css styles using jquery and also make ajax content load without reloading the whole webpage content. - Cross browser support:-
The some core javascript functions not working in in the every browsers but if you are using jquery then it makes cross browser support functionality of the every functions like ajax requests, animations and others.
0 Comments