Title: Theory / Important / CS / Programming / JS / Jquery / Tutorial
Tags: computer_to_instruction automatedNewLineAfterCommaSpace syntactical_sugar

Instruction: jQuery
Language: JQuery
Section: https://learn.jquery.com/about-jquery/how-jquery-works/
Abbreviation: $

Instruction: e.preventDefault();
Effect: Prevent the default behavior associated with the event
Language: JQuery
Section: https://learn.jquery.com/about-jquery/how-jquery-works/
Variables: e an event

Instruction: sel.addClass(foo)
Effect: Add class foo to the html node sel
Language: JQuery
Section: https://learn.jquery.com/about-jquery/how-jquery-works/
Variables: sel a selection

Instruction: $(document).ready(fun)
Effect: Execute fun once the document is ready to be manipulated
Language: JQuery
Section: https://learn.jquery.com/about-jquery/how-jquery-works/
Abbreviation: $(fun)

Name: A callback
Definition: A method, which is called when some other event ends, in an asynchronous way
Page: https://learn.jquery.com/about-jquery/how-jquery-works/

Name: $.fn namespace
Definition: Set of jQuery object methods that can be applied to selection
Page: https://learn.jquery.com/using-jquery-core/dollar-object-vs-function/
Name2: jQuery prototype

Name: A selection
Definition: A set of node, obtained from $("")
Page: https://learn.jquery.com/using-jquery-core/dollar-object-vs-function/
Context: jquery

Name: A utility method
Definition: A jQuery method which does not apply to a selection
Page: https://learn.jquery.com/using-jquery-core/dollar-object-vs-function/
Context: jQuery

Instruction: jQuery.noConflict()
Effect: Set $ to its previous value instead of jQuery
Language: JQuery
Section: https://learn.jquery.com/about-jquery/how-jquery-works/
Returns: jQuery

Instruction: sel.attr("foo")
Language: JQuery
Section: https://learn.jquery.com/using-jquery-core/attributes/
Returns: the value of attribute foo of node sel
Variables: sel a selection

Instruction: sel.attr(
  "foo",
  bar
)
Effect: Set attribute foo of node sel to bar
Language: JQuery
Section: https://learn.jquery.com/using-jquery-core/attributes/
Variables: sel a selection

Instruction: sel.attr(d)
Effect: Set attribute of node sel as in dictionnary d
Language: javascript
Context: JQuery
Section: https://learn.jquery.com/using-jquery-core/attributes/
Variables: sel a selection
d a dictionnary

Instruction: $(selector)
Language: JQuery
Section: https://learn.jquery.com/using-jquery-core/selecting-elements/
Returns: The set of nodes satisfying the selector, either css or some extra selector

Instruction: $(":visible")
Language: JQuery
Section: https://learn.jquery.com/using-jquery-core/selecting-elements/
Returns: The elements actually visible. Except inside of <tr> in which case it rely on css "visible" attribute

Instruction: $(":hidden")
Language: JQuery
Section: https://learn.jquery.com/using-jquery-core/selecting-elements/
Returns: The elements actually visible. Except inside of <tr> in which case it rely on css "hidden" attribute

Instruction: sel.has("foo")
Language: JQuery
Section: https://learn.jquery.com/using-jquery-core/selecting-elements/
Returns: Subset of sel contain a node satisfying selector foo
Variables: sel a selection

Instruction: sel.filter("foo")
Language: JQuery
Section: https://learn.jquery.com/using-jquery-core/selecting-elements/
Returns: Subset of sel with nodes satisfying selector foo
Variables: sel a selection

Question: How to test whether a selected returned an element
Answer: test its length
Page: https://learn.jquery.com/using-jquery-core/selecting-elements/

Instruction: sel.not("foo")
Language: JQuery
Section: https://learn.jquery.com/using-jquery-core/selecting-elements/
Returns: Subset of sel with nodes not satisfying selector foo
Variables: sel a selection

Instruction: sel.eq(i)
Language: JQuery
Section: https://learn.jquery.com/using-jquery-core/selecting-elements/
Returns: i-th element of the list (as a selection)
Variables: sel a selection

Instruction: sel.first()
Language: JQuery
Section: https://learn.jquery.com/using-jquery-core/selecting-elements/
Returns: First element of the list (as a selector)
Variables: sel a selection

Instruction: sel.html(foo)
Effect: Set the html of elements of sel to foo
Language: JQuery
Section: https://learn.jquery.com/using-jquery-core/selecting-elements/
Returns: sel
Variables: sel a selection

Instruction: sel.text(foo)
Effect: Set the text of elements of sel to foo. html will be stripped
Language: JQuery
Section: https://learn.jquery.com/using-jquery-core/selecting-elements/
Returns: sel
Variables: sel a selection

Instruction: sel.height(foo)
Effect: sel
Language: JQuery
Section: https://learn.jquery.com/using-jquery-core/selecting-elements/
Returns: Set the height of first element of sel to foo
Variables: sel a selection

Instruction: sel.html()
Language: JQuery
Section: https://learn.jquery.com/using-jquery-core/selecting-elements/
Returns: The html of the first element of sel
Variables: sel a selection

Instruction: sel.text()
Language: JQuery
Section: https://learn.jquery.com/using-jquery-core/selecting-elements/
Returns: The concatenated text of the elements of sel, with html stripped
Variables: sel a selection

Instruction: sel.height()
Language: JQuery
Section: https://learn.jquery.com/using-jquery-core/selecting-elements/
Returns: The height of the first element of sel
Variables: sel a selection

Name: Chaining
Definition: Applying a method directly over the result of another method
Page: https://learn.jquery.com/using-jquery-core/selecting-elements/
Context: jQuery

Instruction: sel.end()
Page: https://learn.jquery.com/using-jquery-core/selecting-elements/
Language: jQuery
Returns: The first selection, before all refinement of the selection
Variables: sel a selection

Instruction: sel.position()
Page: https://learn.jquery.com/using-jquery-core/selecting-elements/
Language: jQuery
Returns: Position object of first element of sel relative to its first positionned ancestor
Variables: sel a selection
Example: ?

Instruction: sel.val()
Page: https://learn.jquery.com/using-jquery-core/selecting-elements/
Language: jQuery
Returns: The value of the form element
Variables: sel a selection

Instruction: sel.val(foo)
Page: https://learn.jquery.com/using-jquery-core/selecting-elements/
Language: jQuery
Returns: Set the value of the form element to foo
Variables: sel a selection

Instruction: sel.appendTo(foo);
Page: https://learn.jquery.com/using-jquery-core/selecting-elements/
Effect: Move sel to the last position in foo
Language: jQuery
Returns: n (check?)
Variables: sel a selection

Instruction: sel.appendChild(foo);
Page: https://learn.jquery.com/using-jquery-core/selecting-elements/
Effect: Move sel to the last position in foo's children
Language: jQuery
Returns: n?
Variables: sel a selection
Extra: check

Instruction: sel.insertBefore(foo)
Page: https://learn.jquery.com/using-jquery-core/selecting-elements/
Effect: Move sel to the parent of foo before foo
Language: jQuery
Variables: sel a selection

Instruction: sel2.before(sel1)
Page: https://learn.jquery.com/using-jquery-core/selecting-elements/
Effect: Move s1 to before sel2
Language: jQuery
Variables: sel1, sel2 selections

Instruction: sel.clone()
Page: https://learn.jquery.com/using-jquery-core/selecting-elements/
Language: jQuery
Returns: A copy of the first element of sel
Variables: sel selection

Instruction: sel.clone(true)
Page: https://learn.jquery.com/using-jquery-core/selecting-elements/
Language: jQuery
Returns: A copy of the first element of sel, with related data and events
Variables: sel selection

Instruction: sel.remove()
Page: https://learn.jquery.com/using-jquery-core/selecting-elements/
Effect: Removes sel from the dom
Language: jQuery
Returns: sel without its data and events
Variables: sel selection

Instruction: sel.remove()
Page: https://learn.jquery.com/using-jquery-core/selecting-elements/
Effect: Removes sel from the dom
Language: jQuery
Returns: sel with its data and events
Variables: sel selection

Instruction: sel.empty()
Page: https://learn.jquery.com/using-jquery-core/selecting-elements/
Effect: Removes the html content of sel
Language: jQuery
Variables: sel selection

Instruction: $(htmlString)
Page: https://learn.jquery.com/using-jquery-core/selecting-elements/
Language: jQuery
Returns: A node element interpreted as the htmlString
Variables: htmlString a string valid html (i.e. inside a pair of tag)

Instruction: sel.attr(
  "foo",
  fun
)
Page: https://learn.jquery.com/using-jquery-core/selecting-elements/
Language: jQuery
Returns: Set the attribute foo to fun(  idx, foo_value) with idx the zero-based index of the element whose attribute is being changed, and fun_value the current value of the attribute being changed.
Variables: sel a selection

Instruction: $(domObject)
Page: https://learn.jquery.com/using-jquery-core/selecting-elements/
Language: jQuery
Returns: A jQuery object for domObject
Variables: domObject

Instruction: sel.get(i)
Page: https://learn.jquery.com/using-jquery-core/selecting-elements/
Language: jQuery
Returns: The DOM object of the i-th element of the selection
Variables: sel a selection

Instruction: sel.parent()
Page: https://learn.jquery.com/using-jquery-core/selecting-elements/
Language: jQuery
Returns: The immediate parent of sel
Variables: sel a selection

Question: How to test whether selection corresponds to same object
Answer: n1.get(0) === n2.get(0)
Page: https://learn.jquery.com/using-jquery-core/selecting-elements/
Context: jQuery

Definition: A variable refering to a jQueryObject
Page: https://learn.jquery.com/using-jquery-core/selecting-elements/
Context: jQuery
Denoted by: $VariableStartingWithADollar

Instruction: sel.parents(filter)
Page: https://learn.jquery.com/using-jquery-core/selecting-elements/
Language: jQuery
Returns: The ancestors of sel satisfying filter
Variables: sel a selection

Instruction: sel.parentsUntil(foo)
Page: https://learn.jquery.com/using-jquery-core/selecting-elements/
Language: jQuery
Returns: The ancestors of sel up to an ancestor satisfying foo
Variables: sel a selection

Instruction: sel.closest(foo)
Page: https://learn.jquery.com/using-jquery-core/selecting-elements/
Language: jQuery
Returns: The first ancestor (or itself) of sel satisfying foo
Variables: sel a selection

Instruction: sel.children(foo)
Page: https://learn.jquery.com/using-jquery-core/selecting-elements/
Language: jQuery
Returns: All children of sel satisfying filter foo
Variables: sel a selection

Instruction: sel.find(foo)
Page: https://learn.jquery.com/using-jquery-core/selecting-elements/
Language: jQuery
Returns: All descendants of sel satisfying filter foo
Variables: sel a selection

Instruction: sel.prev()
Page: https://learn.jquery.com/using-jquery-core/selecting-elements/
Language: jQuery
Returns: Elements before sel or empty if it does not exists
Variables: sel a selection

Instruction: sel.next()
Page: https://learn.jquery.com/using-jquery-core/selecting-elements/
Language: jQuery
Returns: Elements after sel or empty if it does not exists
Variables: sel a selection

Instruction: sel.sibling()
Page: https://learn.jquery.com/using-jquery-core/selecting-elements/
Language: jQuery
Returns: Both sel.next() and sel.prev()
Variables: sel a selection

Instruction: sel.nextAll()
Page: https://learn.jquery.com/using-jquery-core/selecting-elements/
Language: jQuery
Returns: All siblings after sel
Variables: sel a selection

Instruction: sel.nexPrevAll()
Page: https://learn.jquery.com/using-jquery-core/selecting-elements/
Language: jQuery
Returns: All siblings bferoe sel
Variables: sel a selection

Instruction: sel.sibling()
Page: https://learn.jquery.com/using-jquery-core/selecting-elements/
Language: jQuery
Returns: All siblings sel
Variables: sel a selection

Instruction: sel.css(foo)
Page: https://learn.jquery.com/using-jquery-core/css-styling-dimensions/
Language: jQuery
Returns: css of first element of sel
Variables: sel a selection

Instruction: sel.css(
  "foo",
  bar
)
Page: https://learn.jquery.com/using-jquery-core/css-styling-dimensions/
Language: jQuery
Returns: Set foo css of first element of n to bar
Variables: sel a selection

Instruction: sel.css(dict)
Page: https://learn.jquery.com/using-jquery-core/css-styling-dimensions/
Language: jQuery
Returns: Set css of first element of n as in dict
Variables: sel a selection

Instruction: sel.data(foo)
Page: https://learn.jquery.com/using-jquery-core/css-styling-dimensions/
Language: jQuery
Returns: the data associated to key foo in sel
Variables: sel a selection

Instruction: sel.data(
  foo,
  bar
)
Page: https://learn.jquery.com/using-jquery-core/css-styling-dimensions/
Effect: Set the data associated to key foo in n to bar
Language: jQuery
Variables: sel a selection

Instruction: $.type(foo)
Page: https://learn.jquery.com/using-jquery-core/utility-methods/
Effect: A string representing the type of foo
Language: jQuery

Instruction: Utility Methods
Page: https://learn.jquery.com/using-jquery-core/utility-methods/
Effect: are omitted
Language: jQuery

Instruction: n.each(fun)
Page: https://learn.jquery.com/using-jquery-core/utility-methods/
Effect: Apply fun(idx, el) to each element el of the collection
Language: jQuery
Variables: n a jQuery collection

Instruction: sel.map(fun);
Language: JQuery
Section: https://learn.jquery.com/using-jquery-core/understanding-index/
Returns: A selection containing the fun(i, element_i)
Variables: sel a selection

Instruction: n.index()
Language: JQuery
Section: https://learn.jquery.com/using-jquery-core/understanding-index/
Returns: zero-based index of the node within its parent
Variables: n a node

Instruction: n.index("foo")
Language: JQuery
Section: https://learn.jquery.com/using-jquery-core/understanding-index/
Returns: The index of n counting all elements satisfying "foo" in the entire dom
Variables: n a node

Instruction: n.index(m)
Language: JQuery
Section: https://learn.jquery.com/using-jquery-core/understanding-index/
Returns: The index of m in the collection n
Variables: n, m jQuery collection

Instruction: n.index(d)
Language: JQuery
Section: https://learn.jquery.com/using-jquery-core/understanding-index/
Returns: The index of d in the collection n
Variables: n jQuery collection
d a dom element

Instruction: n.hasClass(foo)
Language: JQuery
Section: https://learn.jquery.com/using-jquery-core/understanding-index/
Returns: Whether n has class foo
Variables: n jQuery collection

Instruction: n.is("foo")
Language: JQuery
Section: https://learn.jquery.com/using-jquery-core/understanding-index/
Returns: Whether n satisfies selector foo
Variables: n jQuery collection

Instruction: sel.width(foo)
Effect: sel
Language: JQuery
Section: https://learn.jquery.com/using-jquery-core/selecting-elements/
Returns: Set the width of first element of sel to foo
Variables: sel a selection

Instruction: sel.width()
Language: JQuery
Section: https://learn.jquery.com/using-jquery-core/selecting-elements/
Returns: The width of the first element of sel
Variables: sel a selection

Instruction: sel.insertAfter(foo)
Page: https://learn.jquery.com/using-jquery-core/selecting-elements/
Effect: Move sel to the parent of foo after foo
Language: jQuery
Variables: sel a selection

Instruction: sel2.after(sel1);
Page: https://learn.jquery.com/using-jquery-core/selecting-elements/
Effect: Move s1 to after sel2
Language: jQuery
Variables: sel1, sel2 selections