Jquery Flashcards

1
Q

What is jQuery?

A

A javascript library that adds functionality

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

What is the jQuery selector function?

A

the $ sign

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

returns a jQuery object

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

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

Need to load the massive jQuery library every time.

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

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

A

HTML document loads from top to bottom

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

.html() or .text() method

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() method

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

html() retrieves data from only the first element of that matched name
text() retrieves data from all elements of the given element name

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

What does .on() do?

A

adds an event listener

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

What is event bubbling?

A

The way in which nested events are handled. The order flow goes from most specific to least specific ->
child to parent

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

What is the difference between event.target and event.currentTarget.

A

event.target is element that triggered the event.

currentTarget is the element the eventhandler is attached to

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

What is the first argument the function setTimeout takes?

A

a function to be called after the timer

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

If the second argument is not passed into the setTimeout function, what is the default value?

A

0

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

What are some scenarios where setTimeout can be useful?

A

countdowns, game clocks, etc

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

What does the setInterval function return?

A

an interval ID that identifies itself

17
Q

What argument does the clearInterval function take?

A

it takes the return value of setInterval

18
Q

What are some scenarios where setInterval can be useful?

A

countdowns, game clocks, etc

19
Q

What is the event loop?

A

A separate concurrent queue for code. when the call stack is empty, code in the event loop is pushed to the call stack.

20
Q

What does the term blocking mean?

A

something is preventing code in the call stack from running

21
Q

What is the call stack?

A

the data structure that arranges the order of actions to be taken by the code

22
Q

Which elements in a website are useful to create dynamically?

A

Things that rely on outside data, such as user input

23
Q

Why should you not create all elements dynamically?

A

can make your page open to attacks,

24
Q

What is a modal?

A

an overlay window with fixed position on the screen

25
What are some use cases for modals?
something to grab the attention of the user,
26
Why does a modal usually need to occupy the entire height and width of the viewport?
So that the user cannot click outside the modal area to avoid it
27
Give two examples of media features that you can query in an @media rule.
width, height
28
Which HTML meta tag is used in mobile-responsive web pages?
"viewport"