Jquery
JS Class Library
Encapsulate common objects or methods, let's write code more efficiently
1.jQuery
2.extjs
"Getting Started with jquery"
Introduction of jquery:
Introduced by the SRC attribute of the script tag
Getting Started: getting jquery objects
$ (Selector) = = JQuery (selector)
Get value
Jquery.val ();
Conversion of jquery objects and Dom objects
Dom object to jquery object: var jquery object = $ (DOM object);
jquery Object swapping DOM object: Way one: var dom = jquery Object [index]
Way two: var Dom = jquery object. Get (Index)
Page Load Success Event
JS native
onload = function () {}
JQuery: Way One: $ (document). Ready (function () {});
Mode two: $ (function () {JS code})
Event Bindings
jquery Event Name: Submit (Form Submit event) Click (Stand-alone button) focus (get Focus) blur (lost Focus)
Click DblClick (mouse clicks)
JS native
Way one: Through the time attribute of the tag binding way two: distribution mechanism element, event name = function () {}
Jquery
jquery object, event (function () {});
Effect
★ Basics (emphasis must be mastered)
Show ([millisecond value]); Show
Hide ([millisecond value]); Hide
Toggle ([millisecond value]);//Toggle
Understanding: Slide-in slide-out
Slideup ([millisecond value]); Slide out
Slidedown ([millisecond value]); Slide in
Slidetoggle ([millisecond value]); Switch
Fade in and fade
FadeIn ([millisecond value]); Fade
FadeOut ([millisecond value]);//Fade out
Fadetoggle ([millisecond value]); Switch
jquery Selector
★ Basic selector: Must be mastered
ID Selector: #id
Class selector:. Class
Element selector: XXX
All selectors: *
Group selector: Select 1, select 2, select 3 ....
★ Hierarchy Selector: Must be mastered
b Descendants of a b:a
A>b:a's B Kids
A+b:a's B's Big Brother
All of A~b:a's B's brothers
Filter selector:
Features: The front has been followed:
: first element
: last Element
: QE (Index) an element of the specified index
: LT (index) is less than
: GT (index) greater than
: Even even
: Odd Odd
Content Filter Selector:
Has (selector):
Visibility Filter Selector:
: Hidden for hidden fields Display=none
: Visible
Attribute selection:
[zz= ' z ']: Check the specified property for the specified value
[ZZ]: Checked as long as the ZZ attribute is included
Form selector:
: input
Select all child elements of the form
Input Select TextArea button
CSS actions and property operations
Gets or sets the element style
CSS ("Property name", "value"): Set CSS style
CSS ("property name"); Gets the value of the specified property name
CSS ({
"Property name 1": "Value 1"
"Property Name 2": "Value 2"
}); JSON setting multiple Styles
Position
Offset
Left: (Ieft)
Top (top)
Width
Height
Property Operation:
<xx Property Name = "Property value"/>
Get Set Property action
attr ("Property name", "value"); Set property
attr ("attribute name");//Get
attr ({
"Property name 1": "Value 1",
"Property Name 2": "Value 2"
})//Set multiple properties
Removeattr ("attribute"); Delete
Add a Style class property
attr ("Class", "Class name 1");
attr ("Class", "Class Name 2")
AddClass ("class name");//Add
Prop ("Class name")
Removeclass ("class name");//delete
My Way of Learning _ 27th Chapter _jquery