jQuery Flashcards

1
Q

JQuery is a _____ _____ that simplifies _____ and _______, event _______ and _______ in JavaScript mush easier.

A

JQuery is a JavaScript library that simplifies traversal and manipulation, event handling and animating in JavaScript mush easier.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Apart from simplifying JavaScript development, one of the main advantages of JQuery is that it works across many different ________.

A

Apart from simplifying JavaScript development, one of the main advantages of JQuery is that it works across many different browsers.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

The jQuery library is a single JavaScript _____. It can be included within a web page by linking to a local copy, like in this example.

A

The jQuery library is a single JavaScript file. It can be included within a web page by linking to a local copy, like in this example.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Load the library from a CDN (Content Delivery Network). A sample CDN is used below. However, JQuery is hosted by various CDNs.

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

With jQuery you select (query) HTML elements and perform “actions” on them. Basic syntax is:

A

$(selector).action();

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

A ____ sign to define/access jQuery

A

A $ sign to define/access jQuery

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

A (selector) to “______” (or find) HTML elements

A

A (selector) to “query” (or find) HTML elements

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

A jQuery action() to be performed on the _________(s).

A

A jQuery action() to be performed on the element(s). Notice that the same action can be preformed on many elements if the query returns many items.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

jQuery uses ____ _______ to select elements.

A

jQuery uses CSS syntax to select elements. (Complex CSS selectors can be used as the query criteria.)

Example:
//hides all paragraph elements on the page
$(“p”).hide();

//hides all elements with a class="imm"
$(".imm").hide();
//hides all elements with an id="imm"
$("#imm").hide();
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

In addition to CSS selectors, jQuery has a few more ways to target elements.

A

1) Existence of an attribute
2) An attribute matching a specific value (exact).
3) An attribute matching a specific value (partial)
4) Attributes containing a value at the start or end of attribute value
5) Matches the content of the element.
6) The element contains some other element

(Note:Multiple selectors can be applied by separating them by commas)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q
$(document).ready(function(){
   // jQuery methods go here...
});
A

Prevent any jQuery code from running before the document is finished loading (is ready).
It is good practice to wait for the document to be fully loaded and ready, before working with it. This also allows you to have your JavaScript code before the body of your document, in the head section.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Here are some examples of actions that can fail if methods are run before the document is fully loaded:

A

Trying to hide an element that is not created yet

Trying to get the size of an image that is not loaded yet

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

There are a few ways to attach events using jQuery:

A

1) Using the event name on a target as a function
2) Using bind() and unbind()
3) Using on and off()
4) Paired handlers like .hover()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Chaining allows us to run multiple jQuery _______, one after the other, on the _____ element(s).

A

Chaining allows us to run multiple jQuery commands, one after the other, on the same element(s).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Consider the following when choosing plugins:
1)
2)
3)

A

1) The publish date and jQuery version used
2) The author
3) Review the actual code

How well did you know this?
1
Not at all
2
3
4
5
Perfectly