jQuery Flashcards
How do you get the text out of an HTML element?
by using .text()
How do you get the value out of an HTML input field?
by using .val()
What’s the difference between .text() and html()?
text() gets the combined text content of each element in the set of matched elements while .html() is used to retrieve info from jquery selector
What does .on() do?
attaches an event handler function for one or more events to the selected elements
What is jquery?
JS library for DOM to write less and be able to do more
What is the jQuery selector function?
$( )
What does the jQuery selector function return?
the list of elements
Why would someone use jQuery over vanilla JS?
less code, and easy to use. To chain actions together
What are some downsides from using jQuery over vanilla JS?
hides the complex parts of JS, one day it won’t be used anymore.
Why do we use the tag at the bottom of the body, instead of putting it inside the tag?
the elements need to be there 1st and HTML document loads top to bottom