a Full-Stack web developer using asp.net. C#, js, win forms
You can download jQuery from https://jquery.com/download/ or you can use a CDN (Content Delivery Network). There are many CDNs for jQuery.
After that, you should reference it to your HTML page (Like CSS but a bit different).
As you know you can write your codes in “script” tags. You can also use the src attribute of script tags for referencing a js file.
Here is an example:
You should assign your jQuery path to the src attribute. For example, my jQuery is in root and I can simply write the name of the file.
You should write your scripts after referencing jQuery because if you write your codes before it, they won’t work.
You can simply write your codes in another .js file or in script tags.
It would look like this:
<script src="jquery-3.5.1.min.js"></script> ... <script> //Your JQuery Codes </script>
jQuery codes are easy to write. The first step is to call jQuery. For this, you should use a “$” at the beginning of your codes.
After “$”, you should select one or many elements. For this, you can use CSS query selectors.
It may look something like this:
<script> $("#MyElementID")... $(".MyClass")... $("MyElementTagName")... </script>
After that, you can modify your elements with jQuery methods. They are many elements available that you can search for in other documentations.
For example, this code will hide an element with “el1” id!
<script> $("#el1").hide(); </script>
jQuery codes look like this:
Thanks for reading
Thanks for reading. My name is Nima Owji. I am a 14 years old programmer. If you had any questions, you can ask me on Twitter! Thank you, have a nice time!
Create your free account to unlock your custom reading experience.