-
-
Notifications
You must be signed in to change notification settings - Fork 10
part 1 of js/homework #6
base: master
Are you sure you want to change the base?
Conversation
Happy0
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work. You've shown a good understanding of manipulating DOM elements and using helper functions / for loops and if statements.
| // 2. Define your event handler (callback <-- function) | ||
| myButton.addEventListener('click', doSomething); | ||
|
|
||
| function doSomething(){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could rename this function to something describing what it does.
Maybe 'changePageElementColours' or something :P
| function changeFontColor(element, colour) { | ||
| element.style.color = colour; | ||
| } | ||
| function jumbotronColor(element, colour) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You aren't using this function. Maybe you don't need it and it can be removed?
| @@ -0,0 +1,44 @@ | |||
|
|
|||
|
|
|||
| function changeBackgroundColour(element, colour, ) { | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the ',' after colour is not valid javascript. Maybe it breaks your function?
|
|
||
| } | ||
| var myButtons = document.querySelectorAll('.colorButton'); | ||
| for (var i = 0; i < myButtons.length; i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ha :). Nice use of a for loop and if statements in the 'changeColor' function.
No description provided.