JQuery Flashcards

1
Q

Where should you go to get jquery?

A

Go to google’s hosted JQuery Library

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

Where should you go to get jquery?

A

Go to google’s hosted JQuery Library

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

What is the script that you MUST include to run JQUERY?

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

What tag must you have for ALL jquery to fall under in order to run?

A

$(document).ready(function(){

}

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

What is the script that you MUST include to run JQUERY?

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

What tag must you have for ALL jquery to fall under in order to run?

A

$(document).ready(function(){

}

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

Say I wanted to add an event handler on click for a button?

A

under the document ready function:

$(‘button’).click(function(){
alert(“You have clicked a button!”);
});

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

What is documentation?

A

Library of eventlisteners in Jquery

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

What is the basic flow of JQuery?

A

1) Select the element, class or id using the JQuery selector.
2) Add an event listener: How do you want this event to be triggered?’
3 Write the code on what you want to happen when the even is triggered?

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

Documentation is API documentation and contains what?

A

How to use documentation and….library of all event listeners in JQuery

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

What are getters and setters?

A

A getter gets the value of something…it spits out a value.

example of a getter:
var myText = $('#myParagraph').text(); 
alert(myText);  //.text() GETS the values from myparagraph and a variable holds this information in this example

example of a setter:
$(‘#myParagraph’).text(‘see how I work as a setter’);

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

This?

A

In what context am I doing this? It’s only doing on THIS.

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

What do you need to understand in jQuery if you want to use APIs and AJAX

A

Dynamic content. It is HTML code that you generate after the page loads.

You must master traversing through HTML elements, which is how we reference HTML elements relative to their containing, or neighboring elements.

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

Why are .html() and .append() so important?

A

Ability to add new HTML content for any page you make. This is called dynamic content. The rules for adding jQuery listeners onto your dynamic content are a little tricky because at first, your browser doesn’t’;t know that the content is even there.

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

What is the most effective way to add event handlers to dynamically rendered HTML content?

A

Use the .on() method.

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

How does .on() work?

A

We must attach the .on() function to something within a selector. However, what you pass into the selector is NOT what you want to attach the event to. What does into the selector is the element that contains the relevant HTML elemnts you ant to attach an event listener to.

17
Q

Break down the following:

$(document).on(‘click’, ‘button’, function(){alert(‘you clicked a button!’)});

A

Sphere of detection of this instance of .on() is paired with the selector for the whole document. That means that the following parameters apply to EVERYTING contained in the entire document. This is the widest scope that you can use on a jQuery function.

18
Q

How many parameters can .on() take?

A

4:

1) the event: are you waiting for a click? A submit? Keydown?
2) Data you with to pass to the handler (this is not required and seldom used). We’re not using it here!
3) The target: i.e. the element you are trying to target. Here we are targeting a button. So now our search is narrowed down listening for a button to be clicked.
4) The function you want to run: Just the stuff you want to attach!

19
Q

Why is the scope of your .on so important?

A

Because it narrows down the sphere of detection. Makijng it faster

20
Q

What is a callback?

A

Essentially saying to run a function when another function calls upon it.

In jQuery you can put functions before the document is ready and so when you call upon them after something is dynamically created.

21
Q

What is AJAX?

A

Maybe the most powerful form of front-end JavaScript right now is AJAX (Asynchronous JavaScript and XML).
Allows page to interact with your database without refreshing the page

Forms are 99% of what AJAX is used for

22
Q

what are the two ways to use .submit()?

A

As an event handler or to actually submit the form

23
Q

what is the value of return false?

A

Well if you don’t want your form to go somewhere because the form wasn’t filled in completely

24
Q

.serialize()

A

The function .seralize() is a function that encodes a set of form elements into a computer-friedly array. Why is this helpful? Because .serialize transofmrs data that the user inputs into a format that can be easily passed to a back-end process and used by a non-human entity.