Giter Site home page Giter Site logo

dom_lab's Introduction

DOM Lab

This lab will ask you to utilize some of the DOM manipulation and event handling techniques discussed in class.

The Setup

We have provided you with index.html. You should investigate the code we've given you. You won't need to edit this file, but it will be helpful to be familiar with its contents.

We've also given you main.css. You also won't need to edit this file, and in fact there is only one style present.

There are several images you will need to access in the images/ directory.

All of your work will occur in app.js. You'll have to write JavaScript to accomplish all of the goals below.

Steps

In app.js, write the necessary JavaScript to:

  1. change the greeting from "Hello, World!" to "Hello, Planet Earth!".

  2. set the backgroundColor of each <li> to yellow.

  3. add the class of selected to an <li> when it is clicked.

  4. change the image to be the last clicked food item.

  5. clicking the reset button should remove the selected class from each <li> and change the image to panic.jpeg.

Hints

  • If none of your code works, have you considered the load event?
  • You may need to loop over the grocery list for some of these operations.
  • There is more than one way to add/remove a class to/from an element, including some we did not cover in class.

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.