jQuery Flashcards

1
Q

What is jQuery?

A

A open source library of JS code

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

What is the jQuery selector function?

A

jQuery() or $()

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

What does the jQuery selector function return?

A

jQuery object with reference to element

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

Why would someone use jQuery over vanilla Javascript?

A

Faster and less code to type

** cross browser compatibility

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

What are some downsides from using jQuery over vanilla Javascript?

A

Huge library to import

People become too reliant on jQuery and can’t do more complicated DOM manipulations with regular JS

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

Why do we use the tag at the bottom of the body, instead of putting it inside the tag?

A

HTML elements need to load first before the JS can run and manipulate them

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

How do you get the text out of an HTML element?

A

.text()

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

How do you get the value out of an HTML input field?

A

.val()

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

What’s the difference between .text() and .html()?

A

** .text - returns only text content** use this

.html - returns html elements

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

How does ajax work?

A
  • give it an object literal with relevant data with destination, how we’re sending data, how we’re getting it back
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Why did we need the jQuery CDN?

A

Because ajax uses jQuery methods

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

How do you specify the request method (GET, POST, etc.) when calling ajax?

A

Under method property

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

Why might you need to build elements dynamically with data from an AJAX request?

A

When we get data can populate information on a webpage with the data received from the request

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

Should you use named functions or anonymous functions for success and error handlers?

A

Named functions, have ways to reference them later

syntax of config options shorter

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