⊗jqBsAb 2 of 113 menu

What is jQuery?

jQuery is a JavaScript library - a set of ready-made functions that help to do some things easier and more conveniently than it is done in pure JavaScript.

Compare two codes that do the same thing - the first one is in pure JavaScript:

document.getElementById('elem').innerHTML = '!';

And the second one is on jQuery:

$('#elem').html('!');

The jQuery code looks much more compact and easier to write.

Compare these two codes: in the first one we get all elements with the class www and set their text color to red using pure JavaScript:

let elems = document.getElementsByClassName('www'); for (let i = 0; i < elems.length; i++) { elems[i].style.color = 'red'; }

And in the second - on jQuery:

$('.www').css('color', 'red');

Here you can already feel a huge difference - in pure JavaScript you had to make a loop, and the jQuery code didn't change much compared to the first example.

byenru