Code Monkey home page Code Monkey logo

phase-0-javascript-events-event-listening-lab's People

Contributors

dependabot[bot] avatar drakeltheryuujin avatar graciemcguire avatar ihollander avatar jenmyers avatar jlboba avatar lizbur10 avatar maxwellbenton avatar professor-ben avatar sgharms avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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

phase-0-javascript-events-event-listening-lab's Issues

Incorrect element id referenced in code snippet in Canvas

Canvas Link

https://my.learn.co/courses/355/assignments/16574?module_item_id=38484

Concern

Canvas references element id "input" in code snippet and elsewhere. The correct element id is "button". It's referenced correctly in the readme.md in GitHub for this lesson.

Now when you click inside of input#input, you will get an alert box. Should be input#button

Additional Context

No response

Suggested Changes

const input = document.getElementById('button');

Difference in the Id Name

In the lesson in Canvas the code includes const input = document.getElementById("button") and instructs students to copy & paste the code into the console in the browser and VS Code in order to pass the test. However, the button's Id is "input" in index.html, not "button" so an error pops up. Not sure if this is intentional or not, but wanted to flag it just in case.

npm test results are broken.

Thanks for raising this issue! Future learners thank you for your diligence. In
order to help the curriculum team address the problem, please use this template
to submit your feedback. We'll work on addressing the issue as soon as we can.

Please fill out as much of the information below as you can (it's ok if you
don't fill out every section). The more context we have, the easier it will be
to fix your issue!

Note: you should only raise issues related to the contents of this lesson.
If you have questions about your code or need help troubleshooting, reach out to
an instructor/your peers.


Link to Canvas

Add a link to the assignment in Canvas here.

Describe the bug

initial npm test results in this:

$ npm test

[email protected] test
mocha --timeout 5000 -R mocha-multi --reporter-options spec=-,json=.results.json

  1. "before all" hook

0 passing (7s)
1 failing

  1. "before all" hook:
    Error: Timeout of 5000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.
    at Object.done (node_modules/mocha-jsdom/index.js:70:7)
    at /mnt/d/Programming/FlatironSchool/code/phase0/phase-0-javascript-events-event-listening-lab/node_modules/jsdom/lib/jsdom.js:312:18
    at processTicksAndRejections (node:internal/process/task_queues:78:11)

Write a clear and concise description of what the bug is. Include the file and
line number(s) if possible.

What is the expected behavior?

Write a clear and concise description of what you expected to happen.

Screenshots

If applicable, attach screenshots to help explain your problem.

What OS are you using?

  • OS X
  • WSL
  • Linux

Any additional context?

Add any other context about the problem here.

Phrasing of "hook up elements to callbacks" seems backwards

Canvas Link

https://learning.flatironschool.com/courses/5185/assignments/179292?module_item_id=396166

Concern

This phrasing seems backwards:
We could then hook up as many elements as we'd like to our clickAlert.

It seems like we are able to attach our cool function to lots of different elements/events rather than attach events to the function. Is this saying that under the covers, the clickAlert function object maintains a list of all the elements it is hooked to?

Additional Context

No response

Suggested Changes

Instead of this:
We could then hook up as many elements as we'd like to our clickAlert.

it seems like the flow is more like:
We could then hook up our clickAlert function to as many elements as we'd like.

Are the callbacks attached to elements or to events?
If I'm missing this, maybe a deeper explanation is needed. :-)

Incorrect getElementById Element for test code

Canvas Link

https://learning.flatironschool.com/courses/5292/assignments/179703?module_item_id=396882

Concern

The input element is input#input, not input#button, when you copy and paste the provided code from the first code block it returns an error in Chrome DevTools console... unless you switch getElementById to:

const input = document.getElementById('input');

Additional Context

No response

Suggested Changes

const input = document.getElementById('input');
input.addEventListener('click', function() {
alert('I was clicked!');
});

addingEventListener() doesn't allow 'click' event to run

Canvas Link

https://learning.flatironschool.com/courses/5639/assignments/179041?confetti=true&submitted=0

Concern

Code:

function addingEventListener() {
    const input = document.getElementById('button');

    input.addEventListener('click', () => {
        document.getElementsByTagName('div')[1].remove();
    });
}

The above code doesn't run in the browser. However, removing the nested code from the addingEventListener() function allows it to run successfully.

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.