Javascript Programing
Javascript Programing
boolean
number
Types Non-Data Types undefined
null onclick (click)
ondblclick (double click)
Array oncontextment (right click)
$("selector").html - replaces html Object
$("selector").text - replaces w/ esc text Object Types Function Mouse Events onmouseenter (pointer enters element)
onmouseleave (pointer leaves element)
$("selector").append("newContent") - inside tag, at end Array Method List onmousedown (click press)
$("selector").prepend("newContent") - inside tag, at
front Date Method List, Format onmouseup (click release)
$("div > p") - p is direct child if (x) {...} else if (y) {...}
$("selector").empty() - removes content
$("div p") - p has any parent div $("selector").remove() - remove w/ its event handlers FOR for (var i=0; i< x.length; i++) {...}
$("ul + div") - div right after ul $("selector").replaceAll("content") - replaces w/ content for ([item] in [array]) {...}
Logic Loops onblur
$("selector").replaceWith("content") - see above, while (x) {...} onchange
content can be a callback function
do {...} while (x) onfocus
WHILE
:first, :last onfocusin
:even, :odd onfocusout
Form Events
$("a").attr("target", "_blank") - add attribute, open in new tab oninput
:not(expression) getElementByID
Attribute Manipulation Find Element oninvalid
:contains('text') $("img").attr({ src: "image.jpg", title:"IMAGE"}) - add attrib using object getElementsByTagName onreset
:gt(), :lt(), eq() - greater than, less than, equal Selector Filters
$("a").removeAttr("href") - removes links getElementsByClassName onsearch
:focus onselect
.style.[property] = "new style"
:animated - in process of being animated Element Attributes onsubmit
.innerHTML = "content"
.mouseleave( [eventData ], handler ) Type Declaration Generator Object: next(),return(), throw() screenX
.mouseout( [eventData ], handler ) AJAX Function Object: apply(), call(), bind() screenY
[object].serialize() -prepare form data let vs. var
[object].serializeArray() -prepare form data Regular Expressions (RegEx)
.toggle( handler, handler [, handler ] ) String Literals (back-tick) key
keyCode
for..of loop (vs. for..in loop, or values vs keys)
charCode
$.ajax( url [, settings ] ) - basic method, shortcuts below
Interfaces (Type Schema)
altKey
.keypress( [eventData ], handler ) Classes (object constructor)
ctrlKey
.keyup( [eventData ], handler )
$.get( url [, data ] [, success ] [, dataType ] ) Advance Javascript Function Decorators
Keyboard Object Properties metaKey
.keydown( [eventData ], handler ) Keyboard Events (shortcuts) $.getJSON( url [, data ] [, success ] ) Features (ES6/TS) Arrow Functions (x => {}) shiftKey
$.getScript( url [, success ] ) Default Parameters (functions)
location
$.post( url [, data ] [, success ] [, dataType ] ) which
Modules (export/import external modules)
$.load( url [, data ] [, complete ] )
Namespaces (internal modules)
Generics
JQuery
External Modules
RxJS: Reactive Javascript