🍎
Introduction to Web Development
  • Introduction To Web Development
  • Tools
    • Notes: Web Development Process
    • Notes: Replit
    • Notes: GitHub
    • Notes: Replit + GitHub Integration
    • GitHub Pages Hosting
  • Week 1: HTML
    • Notes: HTML
    • Notes: Working With Images
    • Project: Hello World
    • Project: Subject of Interest
  • Week 2: CSS
    • Notes: CSS
    • Using CSS for Layout
      • Notes: Box Model
      • Notes: Flexbox
      • Notes: Responsive Layout
    • Project: Styling Subject of Interest
    • Project: Image Gallery
  • Week 3: JavaScript and HTML Forms
    • Notes: JavaScript
    • Notes: Processing HTML Forms with JavaScript
    • Project: Dynamic Style Change
    • Project: Mad Libs
  • Week 4: Web Site Using Bootstrap
    • Notes: Anatomy of a URL
    • Notes: Content
    • Notes: Bootstrap
    • Notes: Overriding Bootstrap
    • Notes: Favicons
    • Notes: License
    • StartBootstrap Templates
    • Project: Bootstrap Website
  • Wrap Up
  • Videos
Powered by GitBook
On this page
  1. Week 3: JavaScript and HTML Forms

Project: Dynamic Style Change

PreviousNotes: Processing HTML Forms with JavaScriptNextProject: Mad Libs

Last updated 1 year ago

In this project, we'll let the user specify the background color, font color, and font family by collecting data from a form.

The HTML and CSS for this project have already been written. To complete the project, you will write the code that handles the Update button click.

  • Locate the code for this project in GitHub:

  • Look at the rendered page in GithHub:

  • Create a Replit project and import the GitHub project into the Replit project.

  • Add a JavaScript event handler to the update-style script.js file. The event handler is triggered by clicking on the Update Button.

  • Use query selectors to get the data entered by the User.

  • If the User didn't choose a Select element, the result will be an empty string "". Test for the empty string, and if it is false, set the style requested by the user.

  • Process the Radio button elements using querySelectorAll and the forEach method to find the checked button and then apply the user's font family style choice. If none of the buttons are checked, don't make any changes.

  • (optional) If the user doesn't select any changes on the form, you can use the alert function to let them know that nothing will be changed.

https://github.com/rebeccapeltz/js-event-handling/blob/main/update-style/index.html
https://www.beckypeltz.me/js-event-handling/update-style
https://github.com/rebeccapeltz/js-event-handling/tree/main
Process the User Input for Page Style