Glasgow | 26-ITP-Jan| Martin McLean |Sprint 3|Quote Generator#1030
Glasgow | 26-ITP-Jan| Martin McLean |Sprint 3|Quote Generator#1030mjm-git185 wants to merge 7 commits intoCodeYourFuture:mainfrom
Conversation
This comment has been minimized.
This comment has been minimized.
| <script defer src="quotes.js"></script> | ||
| </head> | ||
|
|
||
| <body onload="pickNewQuoteToDisplay()"> |
There was a problem hiding this comment.
Suggestion: Look up
Pros and cons between these two approaches to call a function,
callback(), on page load?
<body onload="callback()">in HTML codewindows.addEventListener("load", callback)in JS code
| document.getElementById("quote").innerHTML = "'" + quoteForDisplay + "'"; | ||
| document.getElementById("author").innerHTML = ":-" + authorForDisplay; |
There was a problem hiding this comment.
Suggestion: Look up
The differences between using
.innerHTML,innerText, andtextContentto set text content of an HTML element.
cjyuan
left a comment
There was a problem hiding this comment.
Instead of placing all the "run on load' code in multiple places:
(1) This function call:
<body onload="pickNewQuoteToDisplay()">
and
(2) Code that setup the event listener:
.getElementById("new-quote")
.addEventListener("click", pickNewQuoteToDisplay);
can you practice placing all the "run on load" code inside a function?
Doing so can make it clearer that "this is what runs when the page loads."
For examples,
function setup() {
// code to be executed on page load
}
window.addEventListener('load', setup);or
window.addEventListener('load', function() {
// code to be executed on page load
});|
i have made the change to the setUp on load it seems far more readable like this thanks |
|
Changes look good. Well done. |
Changelist
I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
My changes meet the requirements of the task
I have tested my changes
My changes follow the style guide
my coursework