jQuery—JavaScript simplified
jQuery is JavaScript
- Simplifies the interface to HTML
- Provides a bunch of already made functionality
- Not required to do HTML manipulation
jQuery is essentially just a bunch of pre-written JavaScript
It’s all money from here
Everything that is jQuery is inside the $()
function
Use the $()
function to select & manipulate HTML
Select & go
jQuery follows a simple order:
- Select something in the HTML
- Manipulate that HTML element
Select with CSS
jQuery (and JavaScript) use CSS selectors to grab things in the HTML document
ul
,h1
,div
.dino-list
,.bones
#stego
main > p:first-child
- etc.
Simplifies user interaction
Much is based on user events:
click
,mousemove
,doubleclick
, etc.
jQuery makes this easy:
$('.btn').on('click', function () {
// Do something
});