Giter Site home page Giter Site logo

selecting-reddit's Introduction

#Selecting from Reddit's DOM

We're going to practice some JavaScript based DOM manipulation and traversal in the browser.

Go to reddit and open the JavaScript console (cmd + option + j). Then try to complete the following tasks.

####getElementById

Use getElementById to do the following:

  • find the page header and change it's background color.
  • find the element with the id header-bottom-right and change it's html to say "Hello NAME" (replace "NAME" with your name and make it bold)

####getElementsByClassName

Use getElementsByClassName to find every thumbnail and resize them to 20x20 pixels. (hint: you'll need to use a loop)

####getElementsByTagName

Use getElementsByTagName to add a red background to all links on the page.

####querySelector

Use querySelector to:

  • change the score of the 3rd post on the page.
  • change the text in the search box
    • use .value

####querySelectorAll

Use querySelectorAll to change (re-number) the ranks of the posts so they start from zero instead of 1. (hint: you'll need to use a loop)

###addEventListener

Use addEventListener to add a 'click' event to the 'body' tag that changes the background color of the body. (hint: utilize the style property')

####Extra

  • Try the getElementById, getElementByClassName, and getElementsByTagName items with query selector.
  • Try the querySelector items using getElement....
  • For additional practice try changing other elements of the page using javascript.

selecting-reddit's People

Contributors

bhague1281 avatar kedeger avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.