Class 02 Reading - Ginsusamurai/seattle-301d58 GitHub Wiki
- jQuery for element selectors, performing DOM tasks, handle events
- jQuery is a library that needs to be added to a page
- works in all browsers without fallback code because it uses the correct code based on established internal checks
- selectors always return a collection, even if it is just 1 item
-
getting
info from a collection only returns info from the 0-th item. -
setting
info on a collection does it to all elements in the collection - jQuery objects are just references to DOM elements. It's better to use the same jQuery object over and over, rather than re-run the selector
- give jQuery object variables a leading
$
to differentiate from other variables -
.each()
method on a collection runs against each instance, rather than requiring a loop. Takes in a function to be run, utilizesthis
(for current element) or$(this)
for new jQuery reference of the object -
$(document).ready(function() {//script});
===$(function(){//script});
-
.before()
-> prior to open tag -
.prepend()
-> after open tag -
.append()
-> before close tag -
.after()
-> after close tag - jQuery event methods (pg 326)
-
on()
has multiple variable options: event, selector, data, function()
<script src="//ajax .googl eapi s . com/ ajax/l i bs/ jquery/ 1.10. 2/ jquery .min. js ">
</ script>
<script>
window .jQuery 11 document. write (' <script src=" j s/j query- 1.10 . 2.j s 11><\jscri pt> ' )
</script>
- encourages you to explain the code clearly, listen to guidance, read other peoples code, write code
- Greater Efficiency
- takes slightly longer but for greater quality
- twice as much input, faster research when needed
- Engaged Collaboration
- both people are more focused on the subject
- can help with asking questions and confidence
- Learning
- can expose people to different problem solving techniques
- different skills can be cross taught
- social skills
- can help with communication and social skill development
- job interview readiness
- interviews can have pair programming to estimate fit
- work environment readiness
- pair programming is a skill that many employers have to teach so already knowing it helps
Skim
- lists the various jQuery animations available
Reference
- list of filters and selectors