Section 1

Preview this deck

All <p> elements that are the only child, of its type, of their parent

Front

Star 0%
Star 0%
Star 0%
Star 0%
Star 0%

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Active users

0

All-time users

0

Favorites

0

Last updated

6 years ago

Date created

Mar 14, 2020

Cards (107)

Section 1

(50 cards)

All <p> elements that are the only child, of its type, of their parent

Front

$("p:only-of-type")

Back

The last <p> element

Front

$("p:last")

Back

The document's root element

Front

$(":root")

Back

All elements which contains the text "Hello

Front

$(":contains('Hello')")

Back

All elements with a href attribute value ending with ".jpg"

Front

$("[href!='default.htm']")

Back

All input elements with type="text"

Front

$(":text")

Back

The fourth element in a list (index starts at 0)

Front

$("ul li:eq(3)")

Back

All input elements that are not empty

Front

$("input:not(:empty)")

Back

List elements with an index greater than 3

Front

$("ul li:gt(3)")

Back

All elements with a title attribute value equal to 'Tomorrow', or starting with 'Tomorrow' followed by a hyphen

Front

$("[title|='Tomorrow']")

Back

All input elements with type="password"

Front

$(":password")

Back

All <p> elements

Front

$("p")

Back

All <p> elements that are the only child of their parent

Front

$("p:only-child")

Back

All <p> elements that are descendants of a <div> element

Front

$("div p")

Back

All elements with the class "intro" or "demo"

Front

All elements with the class "intro" or "demo"

Back

All <p> elements that are siblings of a <div> element

Front

$("div ~ p")

Back

All elements with a href attribute value not equal to "default.htm"

Front

$("[href!='default.htm']")

Back

All animated elements

Front

$(":animated")

Back

All <p> elements with a lang attribute value starting with "de"

Front

$("p:lang(de)")

Back

All <p> elements that are the 2nd child of their parent

Front

$("p:nth-child(2)")

Back

All even <tr> elements

Front

$("tr:even")

Back

The first <p> element

Front

$("p:first")

Back

All <p> elements that are the last <p> element of their parent

Front

$("p:last-of-type")

Back

All elements with a href attribute

Front

$("[href]")

Back

The element with id="lastname"

Front

$("#lastname")

Back

All hidden <p> elements

Front

$("p:hidden")

Back

All <div> elements that have a <p> element

Front

$("div:has(p)")

Back

All odd <tr> elements

Front

$("tr:odd")

Back

All elements that are empty

Front

$(":empty")

Back

All input elements

Front

$(":input")

Back

All elements with a href attribute value equal to "default.htm"

Front

$("[href='default.htm']")

Back

elements that are the first child of their parent

Front

$("p:first-child")

Back

All <p> elements that are the first <p> element of their parent

Front

$("p:first-of-type")

Back

All visible tables

Front

$("table:visible")

Back

All header elements <h1>, <h2> ...

Front

$(":header")

Back

The <p> element that are next to each <div> elements

Front

$("div + p")

Back

All <p> elements that are a direct child of a <div> element

Front

$("div > p")

Back

All <p> elements that are the last child of their parent

Front

$("p:last-child")

Back

All elements with a title attribute value containing the word "hello"

Front

$("[title*='hello']")

Back

The element that currently has focus

Front

$(":focus")

Back

All <p> elements that are the 2nd <p> element of their parent

Front

$("p:nth-of-type(2)")

Back

All <p> elements that are the 2nd child of their parent, counting from the last child

Front

$("p:nth-last-child(2)")

Back

All elements with a title attribute value containing the specific word "hello"

Front

$("[title~='hello']")

Back

All <p> elements that are the 2nd <p> element of their parent, counting from the last child

Front

$("p:nth-last-of-type(2)")

Back

All elements that are a parent of another element

Front

$(":parent")

Back

All <h1>, <div> and <p> elements

Front

$("h1,div,p")

Back

All elements with a title attribute value starting with "Tom"

Front

$("[title^='Tom']")

Back

Selects All elements

Front

$("*")

Back

Selects All elements with class="intro"

Front

$(".intro")

Back

List elements with an index less than 3

Front

$("ul li:lt(3)")

Back

Section 2

(50 cards)

When the "button" element is clicked set the background-color css value for "p" elements to "yellow"

Front

$("button").click(function(){ $("p").css("background-color", "yellow"); });

Back

The function is executed when the form field loses focus:

Front

$("xxx").blur(function(){ $xxx; });

Back

When "button" element is clicked, 3 diffrent animations are activated on the "div" element simultaneously.

Front

$("button").click(function(){ $("div").animate({ xxx: 'xxx', xxx: 'xxx', xxx: 'xxx', }); });

Back

On click, fade in "p" elements, slowly.

Front

$("xxx").click(function(){ $("p").fadeIn("slow") });

Back

All disabled input elements

Front

$(":disabled")

Back

The hover() method takes two functions SEPERATED BY A COMMA and is a combination of the mouseenter() and mouseleave() methods. The first function is an alert saying "You entered" is executed when the mouse enters the HTML element The second function is an alert saying "You now leave" is executed when the mouse leaves the HTML element:

Front

$("xxx").hover(function(){ alert("You entered"); }, function(){ alert("You now leave"); });

Back

Attach multiple (3) event handlers to a <p> element

Front

$("p").on({ xxx: function(){ $xxx; }, xxx: function(){ $xxx; }, xxx: function(){ $xxx; } });

Back

All checked input elements

Front

$(":checked")

Back

On Click, hide "p" elements in 1000 milliseconds

Front

$("xxx").click(function(){ $("p").hide(1000); });

Back

When the "button" element is clicked change 2 attributes of an element with an id of "xxx": First, change "href" attribute to "abc.com". Then, change the "title" attribute to "new title"

Front

$("button").click(function(){ $("#xxx").attr({ "href" : "abc.com", "title" : "new title" }); });

Back

When the "button" element is clicked run a function chaining 3 actions: First change text color to red. Second, make element slide up in 2000 ms. Third, make the element slide down in 2000 ms.

Front

$("button").click(function(){ $("p").css("color", "red").slideUp(2000).slideDown(2000); });

Back

An alert saying "You now leave" is executed when the mouse pointer leaves the HTML element

Front

$("xxx").mouseleave(function(){ alert("You now leave"); });

Back

Removes all <p> elements with class="test" and class="demo"

Front

("p").remove(".test, .demo");

Back

An alert saying "Mouse up over" is executed, when the left mouse button is released, while the mouse is over the HTML element

Front

$("xxx").mouseup(function(){ alert("Mouse up over"); });

Back

When the "button" element, run a function that hides the "p" element slowly and has a callback function that is an alert that says "hidden".

Front

$("button").click(function(){ $("p").hide("slow", function(){ alert("hidden"); }); });

Back

When a double click event fires on a <p> element; hide the current <p> element

Front

$("p").dblclick(function(){ $(this).hide(); });

Back

All input elements with type="file"

Front

$(":file")

Back

Prepend some text saying "xxx" to a "p" element

Front

$("p").prepend("xxx");

Back

when creating a variable that is assigned to a jQuery Selector, what should the name of the variable be

Front

$target = $('tjhing that your trying to get')

Back

Remove an element with an id of "xxx"

Front

$("#xxx").remove();

Back

All input elements with type="radio"

Front

$(":radio")

Back

On Click, show "p" elements in 1000 milliseconds

Front

$("xxx").click(function(){ $("p").show(1000); });

Back

When the "button" element is clicked set the background-color css value for "p" elements to "yellow" and the font-size css value to "200%"

Front

$("button").click(function(){ $("p").css({"background-color": "yellow", "font-size": "200%"}); });

Back

When the "button" element is clicked toggle the css class of "blue" in the "p" element

Front

$("button").click(function(){ $("p").toggleClass("blue"); });

Back

All selected input elements

Front

$(":selected")

Back

The function is executed when the form field gets focus

Front

$("xxx").focus(function(){ $xxx; });

Back

All input elements with type="checkbox"

Front

$(":checkbox")

Back

All input elements with type="reset"

Front

$(":reset")

Back

Remove child elements of an parent element with an id of "xxx"

Front

$("#xxx").empty();

Back

All input elements with type="button"

Front

$(":button")

Back

When the "button" element is clicked sets the width and height of an element with an id of "xxx" to 500px

Front

$("button").click(function(){ $("#xxx").width(500).height(500); });

Back

When the "button" element is clicked remove a css class of "blue" to the "p" element

Front

$("button").click(function(){ $("p").removeClass("blue"); });

Back

When the "button" element is clicked change the "href" attribute of an element with the id of "xxx" to "abc.com"

Front

$("button").click(function(){ $("#xxx").attr("href", "abc.com"); });

Back

On click, fade "p" elements to an opacity of 50%, slowly.

Front

$("xxx").click(function(){ $("p").fadeTo("slow", 0.5); });

Back

When the "button" element is clicked add a css class of "blue" and "hidden" to the "p" element

Front

$("button").click(function(){ $("p").addClass("blue hidden"); });

Back

When a click event fires on a <p> element; hide the current <p> element

Front

$("p").click(function(){ $(this).hide(); })

Back

When the "button" element is clicked, it moves the <div> element to the right, until it has reached a left property of 250px:

Front

$("button").click(function(){ $("div").animate({left: '250px'}); });

Back

All input elements with type="image"

Front

$(":image")

Back

When the "button" element is clicked run a function that is an alert saying whatever the value of the "href" attribute that is connected to an element with the id of "xxx"

Front

$("button").click(function(){ alert($("#xxx").attr("href")); });

Back

On Click, toggle fade of "p" elements

Front

$("xxx").click(function(){ $("p").fadeToggle(); });

Back

An alert saying "enter" is executed when the mouse pointer enters the HTML element

Front

$("xxx").mouseenter(function(){ alert("enter"); });

Back

An alert saying "Mouse down over" is executed, when the left mouse button is pressed down, while the mouse is over the HTML element

Front

$("xxx").mousedown(function(){ alert("Mouse down over"); });

Back

When "button" element is clicked, "div" element slides down

Front

$("button").click(function(){ $("div").slideDown(); });

Back

All input elements with type="submit"

Front

$(":submit")

Back

Append some text saying "xxx" to a "p" element

Front

$("p").append("Some appended text.");

Back

All enabled input elements

Front

$(":enabled")

Back

Remove all <p> elements with class="test":

Front

$("p").remove(".test");

Back

When the "button" element is clicked run a function that is an alert saying whatever text is in an element with the id of "xxx"

Front

$("button").click(function(){ alert($("#xxx").text()); });

Back

On Click, toggle visibility of "p" elements

Front

$("xxx").click(function(){ $("p").toggle(); });

Back

The example below has a callback parameter that is a function that will be executed after the hide effect is completed:

Front

$("button").click(function(){ $("p").hide("slow", function(){ alert("The paragraph is now hidden"); }); });

Back

Section 3

(7 cards)

when attempting to edit a vlue of something , when do you use the html() method and the .val method

Front

.html() can be used to set the contents of the first element match it finds. For instance, .val() is used to get the value of form elements. For example, $('input:checkbox:checked').val();

Back

what does the toggleClass do

Front

used to swtich elements on and off

Back

how do you select mulitple things in one selector

Front

$('p, li').fadeTo('slow', 0);

Back

what should all javascript be encapsulated in?

Front

$(document).ready(function(){ });

Back

how do you get the value from an input with a name

Front

$('input[name=checkListItem]').val();

Back

what are two html elements that can receive focus

Front

<textarea>s and <input>

Back

what is the .on() method and what does it do?

Front

a general handler that takes the event, its selector, and an action as inputs. The syntax looks like this: $(document).on('event', 'selector', function() { Do something! });

Back