In this video, we'll select and change the headline color, but this time, we'll do it in response to clicking a button.
- Spelling - If you get an undefined error when trying to grab an element you may have incorrectly spelled the argument being passed.
- Case Sensitivity - Make sure your capitalizations are proper camelCase and the correct letters are capitalized.
Accessing the value of an input element
value property to get the text that has been entered into an input element. For example, if you have a text input stored in a variable
myInput, you can retrieve any text the user has typed into that input like this:
Experiment with the app
- Add a button that always resets the title to black
- Create another field that sets a different
styleattribute of the headline
You need to sign up for Treehouse in order to download course files.Sign up