Skip to content

Instantly share code, notes, and snippets.

@elenawalom
Forked from laurenhavertz/Day 12.md
Created July 3, 2013 22:51
Show Gist options
  • Save elenawalom/5923554 to your computer and use it in GitHub Desktop.
Save elenawalom/5923554 to your computer and use it in GitHub Desktop.

How to start

  • deconstruct a program and turn it into steps-comment out in the editor
  • start with the most simple step
  • test small things in the console to reaffirm basic assumptions (do my expectations meet my results?)
  • DIVIDE AND CONQUER

##jQuery

  • div divides blocks
  • span divides in-line text
  • grabs something on the page and can see the value

look up jQuery event documentation

$('input').val('') # sets value

var message = $('input').val() # gets value
declare variables, insert functions, run code

####Event Oriented "For Loop" function rotateImage() { $('img.js-pic').attr('src', pics[i]); i += 1; if (i === pics.length) { i = 0; } }

Reference 'jsFiddle photo'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment