JQuery
#
JQuery Basics#
1) What is jQuery?jQuery is a fast, small, and feature-rich JavaScript library. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers. (jQuery, n.d.)
#
2) How do you install/use jQuery?Thereβs three easy ways for installing jQuery:
#
π Using jQuery with a CDNAdding CDN code for minified jQuery lib. you can copy and past it into the head section on your HTML page.
You can find all the jQuery versions here.
Google is an example of someone who host jQuery:
#
π Downloading jQueryThere are two versions of jQuery available for downloading: production version and development version.
You can download both versions from jQuery.com
Remember that jQuery library is a single JavaScript file, and you have to reference it with the HTML <script> tag
inside the <head> section
. Your html will look like this:
#
π Installing via npm, yarn or bowerYou can install the latest version of jQuery with the npm CLI command:
This will install jQuery in the node_modules directory. Within node_modules/jquery/dist/ you will find an uncompressed release, a compressed release, and a map file.
This will install the default being bower_components. Within bower_components/jquery/dist/ you will find an uncompressed release, a compressed release, and a map file. If you want more information about how to download and install Jquery, watch this video.
#
3) What is a library?A library is a set of code that someone was previously written, that can be called upon when you're building your own projects. The goal is to streamline development, make it easier.
The libraries may include configuration data, documentation, help data, message templates, pre-written code and subroutines, classes, values or type specifications.
#
4) Which elements does this CSS selector retrieve in Jquery? π²jQuery supports most CSS3 selectors, as well as some non-standard selectors. You can find it all in w3school. Letβs take a look between jQuery and Vanilla Javascript differences:
#
By Attribute:#
By Compound CSS Selector:#
With a comma-separated list of selectors:#
With Pseudo-Selectors:#
By form elements:#
5. How do you change an inline style of an HTML element?Single style
Multiple style
toggleClass. What is the use of the optional parameter switch?#
6. Have a look at the Jquery methodSintax
By using the "switch" parameter, you can specify to only remove, or only add a class name.
As a rule, toggleClass() method checks each element for the specified class names. If the class exists, it is removed. If it doesn't exist, it is added. In the following example you can see how to create two buttons. One that adds the class βmainβ and another that removes it.
#
GitHub project of your own solved using JQuery.#
JQuery learning resourceYoutube video about a crash course in order to learn JQuery
Find a link to retrieve the 50 most asked questions about JQuery in a job interview
Find a github repository with some examples using JQuery
Link a Github repository with the tag awesome about JQuery.
Other resources:
#
π External linksjQuery. (n.d.). jQuery. Retrieved January 13, 2021, from jquery.com/
jQuery Selectors. (n.d.). Retrieved January 13, 2021, from www.w3schools.com/jquery/jquery_ref_selectors.asp
Library (computing) - Wikipedia. (n.d.). Retrieved January 13, 2021, from en.wikipedia.org/wiki/Library_(computing)
jQuery Get Started. (n.d.). Retrieved January 13, 2021, from www.w3schools.com/jquery/jquery_get_started.asp
Download jQuery | jQuery. (n.d.). Retrieved January 13, 2021, from jquery.com/download/