Skip to content

Instantly share code, notes, and snippets.

@khalidwilliams
Last active February 12, 2020 04:40
Show Gist options
  • Save khalidwilliams/c1d750063d25307ae093364efb7f8cb6 to your computer and use it in GitHub Desktop.
Save khalidwilliams/c1d750063d25307ae093364efb7f8cb6 to your computer and use it in GitHub Desktop.

jQuery DOM Practice

This gist contains some exercises to practice jQuery DOM traversal.

We'll use this list of presidents to practice.

Complete the following exercises in repl. You can always console.log things to verify your selections work.

  1. Select all of the tr elements.
  2. Make the background color of cells in the Name, Term and Party Affiliation columns red, white and blue, respectively.
  3. Make the check box cells of any Federalist, whig and democratic presidents blue (you can add a class of blue)
  4. Make the check box cells of any Democratic-Repbulicans or Republican presidents red (you can add a class of red).
  5. Make the whole row of any presidents who served after a president died purple
  6. If a president is checked, make their column purple.
  7. Add a new president to the table when you click the 'add president' button (you can hard code their information).
  8. Remove a president (specified by their number) when you click the 'Remove President' button
  9. Refactor step 7. Make a form with the number, name, term length and party of your new president.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment