Generate goals for next year.
Use Functions, Arrays, If Statements, Events and more to create a goal generator.
To complete this project, students should have the following:
- Intermediate understanding of HTML elements (divs, images, attributes, structure...etc.)
- Intermediate understanding of CSS (Flexbox, absolute positioning...etc.)
- Intermediate understanding of JS (DOM, Events, variables, if statements, arrays)
To complete Part I, fulfill the following requirements:
- Set up your file structure in the command line:
- index.html
- styles.css
- app.js
- Link your files.
To complete Part II, fulfill the following requirements:
- Create a
div
with anid
of "container". - Inside of this container div, create a text element (header or p) with the text of "What will your goal next year be?" and an
id
of "goal". - Still inside of this container div, create a
button
with anid
of "button" and text of "Random category."
To complete Part III, fulfill the following requirements:
- Design your goal generator as you like. Style at least 3 elements.
To complete Part IV, fulfill the following requirements:
- Create variables to store your button and goal elements.
- Create an array called "categories" that will store at least 4 categories that you may want to improve (Strings) (e.g. 'mind', 'body', 'school'..etc.)
- For each element in your categories array, create another array with at least 3 specific goals in that category.
Example:
var categories = ["school", "category2", "category3", "category4"];
var school = ["Study once a week", "Goal2", "Goal3"];
- When we click on the button, the following should happen:
- The text in the element with id of goal should be changed to a random CATEGORY
- The text in the button should be changed to "Random goal."
- When we click the button AGAIN, the text in the goal element should be changed to random GOAL
Hint: Think about how we can detect if the button is clicked again. What can we check for? What is different when we click it the second time vs. the first time?
- Add images to associate with each goal.
- Create a simple goal plan with notes and images of how you plan to achieve 1 goal.
Resources: