CPNT-262 Achievement 3 - Press of a Button
- Due: Sunday, Feb 13 @ 11:59pm
- Weight: 5% of the final mark
Learning Outcomes
This achievement will be marked out of 5 points where you will:
- 1 point: Assign a DOM element to a variable using
const
anddocument.querySelector
. - 2 points: Add an Event Listener to this DOM variable using
Element.addEventListener
that logs DOM information to the Console. - 1 point: Bonus point for doing one of the following:
- not using a
<button>
as the DOM element; - not using
click
as the event trigger; - visibly changing the page in some way.
- not using a
- 1 point: Document this activity in a Code Journal section of the project README (see last step in the Instructions).
Points will be deducted for code that is too similar to examples shown in class.
Instructions
- Take a section of code that outputs DOM content using
console.log
.- Suggestions for beginners:
- Log the text of the button using
Element.innerText
- Log the text of the button using
- Any other code will do as long as:
- it's not broken;
- it prints information found in the DOM.
- Suggestions for beginners:
- Wrap the code into a named function.
- The code should not execute when the page loads.
- Attach this function to a
<button>
element on the HTML page. - Click the button to invoke your function and output DOM content to the DOM.
- Include a
README.md
file with the following information:- Your name, course and assignment title;
- Attributions: Did anyone help you? Give credit to any classmates, articles, tutorials, etc that helped you complete this project.
- Journal: Include self-assessments, observations, research, etc under the heading "Code Journal".
Submission
- Create a GitHub repo of your project;
- Download a ZIP of the project;
- In Brightspace, submit your ZIP and include the following as a comment in your submission:
- a link to your GitHub repo;
- a link to the GitHub Pages site;