Basic Syntax:
$(''.on(''), function () {
// Add Event Handler
});
- Selector
- Event
- Callback Function
Append and Prepend inject content INSIDE the specified selector. Before and After inject content OUTSIDE the specified selector.
- Append - Inside, After
- Prepend - Inside, Before
- Before - Outside, Before
- After - Outside, After
Note: Cannot append or prepend content to self-closing tags.
- html() - Replaces Content with HTML (tags converted properly)
- text() - Replaces Content with Plain Text
- attr() - Replaces Attribute Content
- data() - jQuery.data(element, key, value)
$("img").attr("width","500");
- remove() - Deletes Element
- empty() - Deletes Content of Element
$('p').remove();
$('button').remove();
$('input').prop('type');
$('.container').prop('type');
- .hasClass()
- Boolean check for a specific class.
- .addClass()
- .removeClass()
- .toggleClass()
-
Basics:
- .hide ()
- .show()
- .toggle()
-
Opacity:
- .fadeIn()
- .fadeOut()
- .fadeToggle()
-
Transitions:
- .slideIn()
- .slideOut()
$('body')
.append(videoHTML)
.prepend("blah")
.addClass('pink')
;
$('body').append(videoHTML).prepend("blah").addClass('pink');
Sorting Arrays |
---|
if a < b |
if b < a |
if a == b |
if a <=> b |