Coder Social home page Coder Social logo

phase-1-practice-interacting-with-the-dom's Introduction

Interacting with the DOM using Events

Learning Goals

  • Create event listeners on DOM nodes using addEventListener()
  • Manipulate the DOM in response to events

Instructions

If you open up index.html in the browser, you'll find a small application. It has a few features:

  • A Counter that increases by 1 each second
  • Plus and Minus buttons that increment or decrement the counter
  • A "like" button (❤️) that adds a "like" for the number that is currently displayed by the timer
  • A comment box that adds comments when submitted

First, take a few minutes to explore and test out the behavior of the page. Think about how each of the features must work. What must be happening underneath each of these features?

The challenge is to reverse engineer these features and build them yourself, using what you've learned about JavaScript and DOM Manipulation.

Note that there are no tests for this lab. To confirm if the application is working, you'll have to manually test the application in the browser.

Once you're done, be sure to commit and push your code up to GitHub, then submit the assignment using CodeGrade. Even though this practice lab does not have tests, it must still be submitted through CodeGrade in order to be marked as complete in Canvas.

Getting Started

To begin, comment out the script tag linking to js/index.min.js in the html file. This will "shut off" the existing behaviors so you can begin recreating them, using the js/challenge.js file to write your code. You can see the <script> tag that loads this file just after the one for index.min.js.

Deliverables

Add the following features one by one, refreshing the page to see your functionality working as you build.

Note: These deliverables are written in the form of User Stories. They describe the features from the perspective of a user when they visit the page.

As a user, I can:

  • See the timer increment every second once the page has loaded.
  • Manually increment and decrement the counter using the plus and minus buttons.
  • "Like" an individual number of the counter. I should see the count of the number of "likes" associated with that number displayed.
  • Pause the counter, which should:
    • pause the counter
    • disable all buttons except the pause button
    • switch the label on the button from "pause" to "resume"
  • Click the "resume" button to restart the counter and re-enable the buttons.
  • Leave comments on my gameplay, such as: "Wow, what a fun game this is."

Timer Hints

If you're not sure how to create or pause a timer, look into:

phase-1-practice-interacting-with-the-dom's People

Contributors

alexgriff avatar davidwolff218 avatar ihollander avatar jlboba avatar lizbur10 avatar maxwellbenton avatar rrcobb avatar sgharms avatar thuyanduong-flatiron avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

phase-1-practice-interacting-with-the-dom's Issues

Button label inconsistency

Canvas Link

https://learning.flatironschool.com/courses/6190/assignments/225624?module_item_id=526914#:~:text=Click%20the%20%22restart%22%20button%20to%20restart%20the%20counter%20and%20re%2Denable%20the%20buttons.

Concern

Text reads:

• switch the label on the button from "pause" to "resume"
• Click the "restart" button to restart the counter and re-enable the buttons.

Was this meant to say the "resume" button?
Since the demo program doesn't have a "restart" button, are you requesting that we build an additional button that is not present in the example program? The intention is unclear.

Additional Context

No response

Suggested Changes

No response

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.