Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is $( ) JavaScript or jQuery notation?

I'm trying to differentiate between the JavaScript and jQuery; to sculpt accurate models of what the two represent.

Originally, I had thought that jQuery was a collection of libraries, plug-ins, and tool kits. I came to this notion due to what a peer told me, from reading around on the Internet, and also because I've been using Slick (an image carousel) which I downloaded from jQuery.

Yet as I've been developing more and getting to know JavaScript, instead of doing specific calls to a library I downloaded (Slick):

$('.multiple-items').slick({...});

I've lately been doing calls like the following:

$('.mid-buttons').click(function(){...});

Which confuses me, because I never downloaded any jQuery library other than Slick, so is .click part of some automatically downloaded jQuery library or part of what comes with JavaScript?

Also, is $() used for any calls to an object in HTML/CSS or is the methods being called, .slick or .click, what dictates the usage of $( )?

I know that these are extremely amateur questions but it's been tough finding a resource that explicetely differentiates the distinction I am trying to make/understand. Thanks!

like image 910
8protons Avatar asked Dec 14 '22 08:12

8protons


1 Answers

JavaScript is a programming language.

jQuery is a library written in JavaScript.

$ is a valid identifier name in JavaScript.

jQuery uses $ as the variable name for its main function (it also uses jQuery). This function is defined in the jQuery documentation.

When you call it as a function (generally with the syntax $(some arguments here)), the return value is a jQuery object. These usually wrap some DOM nodes.

Slick is a plugin. It is another library that expands the functionality of jQuery (using the jQuery plugins api). It provides a method that you can call on jQuery objects.

like image 52
Quentin Avatar answered Dec 17 '22 02:12

Quentin