-
Notifications
You must be signed in to change notification settings - Fork 7
/
javascript.jquery.core.sheet
47 lines (35 loc) · 3.24 KB
/
javascript.jquery.core.sheet
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# jQuery Core
$(fn) Same as $(document).read(function(){})
$(selector) Query DOM using css selectors
$(selector, context) Query context using css selectors
$(html) Construct elements (IE requires "type" attr for inputs)
$(elements) Construct jQuery object from one or more elements
$(jQuery) Passes jQuery objects through
## Accessors
$(...).get(index) Get DOM element at the given index
$(...).length Number of DOM elements matched
$(...).size() Number of DOM elements matched
$(...).selector Return selector string used
$(...).context Return context used
$(...).each(fn) Iterate using fn callback; 'this' becomes the element
$(...).index(element) Return index of the given element or -1
## Data
Data methods refer to first element in the collection.
$(...).data(key) Get data for key if present
$(...).data(key, val) Set data for key to val (strings, objects, etc)
$(...).removeData(key) Remove data for key
## Plugins
$.fn.extend({
check: function(){
return this.each(function(){
this.checked = true
})
}
})
$(...).check()
$.extend({
say: function(msg) {
alert(msg)
}
})
$.say('hey')