To start using jQuery in a web page we have to install jQuery in the web project so that it is available when the page loads.
There are two ways to do this:
The file must be placed in a folder within our project and then added to the web page using HTML code as follows:
<head>
<script src="js/jquery-3.6.3.js"></script>
</head>
"js" is the folder where we have located the file.
<script src="https://code.jquery.com/jquery-3.6.3.slim.min.js" integrity="sha256-ZwqZIVdD3iXNyGHbSYdsmWP//UBokj2FHAxKuSBKDSo=" crossorigin="anonymous"></script>
On that page we will choose between one of these options:
We check that JQuery is working properly from the web browser inspector tool. We can open the Mozilla firefox inspector in any of the following ways:
In the console tab we write:
$(); If it returns something other than "nul "l JQuery is installed correctly.
jQuery; If it returns anything other than "*jQuery is not defined", then JQuery is installed correctly.
Once we have jQuery installed in our web project we can create scripts inside the <script> tags. When inserting jQuery in our web project it is recommended to do it at the end of the web page before the </body> tag.
<html>
<head><title></title></head>
<body>
<p>Content html ...</p>
...
<script src="https://code.jquery.com/jquery-3.6.3.slim.min.js" integrity="sha256-ZwqZIVdD3iXNyGHbSYdsmWP//UBokj2FHAxKuSBKDSo=" crossorigin="anonymous"></script>
</body>
</html>
jQuery also has another version called jQuery UI: it is a component library that in addition to having all the content of jQuery also has more plugins, effects and widgets.
Link: https://releases.jquery.com/ui/
Tips on SEO and Online Business
Next Articles
Previous Articles