jQuery Flashcards
all jQuery functions start with …
$
add classes to elements
.addClass() function
select CSS class
.class
select CSS id
id
select type
html element
remove class from elements
.removeClass() function
change the CSS of an element with…
.css()
.css(“color”,”blue”);
adjust the properties of elements (non-CSS)
.prop()
.prop(‘disabled’, true)
add HTML tags and text within an element
.html()
$(“h3”).html(“<em>jQuery Playground</em>”);
.text() and what it does
only alters text without adding tags, otherwise similar to .HTML()
will not evaluate any HTML tags passed to it, but will instead treat it as the text you want to replace the existing content with.
remove an HTML element entirely
.remove()
select HTML elements and append them to another element
.appendTo(“#id”)
make a copy of the element
.clone()
access the parent of whichever element
.parent()
access the children of whatever element
.children()
CSS selector allows you to select all the nth elements with the target class or element type
target:nth-child(n)
give the third element in each well the bounce class
$(“.target:nth-child(3)”).addClass(“animated bounce”);
target odd and even elements
target:odd (:even)
index is 0-based, so odd selects 1,3,5 etc.