jQuery
jQuery is a lightweight, "write less, do more", JavaScript library.
Features:
HTML/DOM manipulation
CSS manipulation
HTML event methods
Effects and animations
AJAX
Utilities
Usage
Syntax
A
$
sign to define/access jQueryA
(
selector
)
to "query (or find)" HTML elementsA jQuery
action()
to be performed on the element(s)
Selectors
jQuery selectors allow you to select and manipulate HTML element(s).
jQuery selectors are used to "find" (or select) HTML elements based on their name, id, classes, types, attributes, values of attributes and much more. It's based on the existing CSS Selectors, and in addition, it has some own custom selectors.
The jQuery element selector selects elements based on the element name. eg.
$("p")
The jQuery
#id
selector uses theid
attribute of an HTML tag to find the specific element. eg.$("#test")
The jQuery
.class
selector finds elements with a specific class. eg.$(".test")
Events
Mouse Events | Keyboard Events | Form Events | Document/Window Events |
---|---|---|---|
click | keypress | submit | load |
dblclick | keydown | change | resize |
mouseenter | keyup | focus | scroll |
mouseleave |
| blur | unload |
Last updated