Giter Site home page Giter Site logo

dom-practice's Introduction

Working with the DOM

Today we're going to be practicing DOM manipulation and event handling.

Learning Objectives

  • DOM Manipulation
  • Event Handling

Resources

This DOM Gist has a helpful section on DOM querying and creation

Setup

You're provided a basic website with included index.html, style.css, and script.js. All of your work will go in script.js - you shouldn't have to edit index.html or style.css.

Please create individual functions for each solution. Don't forget to call the function once you're finished.

Completion

Give it your best shot!

Accessing DOM Elements (Querying)

Let's start with some simple query selecting.

Part 1

DOM's personal website title is a bit wordy. Write a JavaScript statement that selects the #main-title ID element. Remember there are a couple of ways to query id. Change the text of the title to something shorter.

Part 2

Select the body and change the background-color to a new color of your choice.

Part 3

Select DOM's Favorite Things list and remove the last list item.

Part 4

Select all .special-title class elements and change their font-size to 2rem. Remember you might have to iterate through the list of elements

Part 5

Turns out DOM never raced in Chicago. Access the Past Races list and remove Chicago.

Creating New DOM Elements

Part 6

Let's add to DOM's Past Races list. Create a new <li> element, change the new <li> text to the name of a city, and append it to the Past Races list.

Part 7

Create a new .blog-post corresponding to the new city added in Part 6. You will have to create a new <div> with class of .blog-post, a new <h1> with text, and a new <p> with some text. Make the new element consistent with the other posts. Think about what order you want to create the elements, and what order you want to append them in.

dom-practice's People

Contributors

jonathanh7 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.