FAQs on the exercise _ Create and Insert Elements_
There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply () below.
If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.
Join the Discussion. Help a fellow learner on their journey.
Ask or answer a question about this exercise by clicking reply () below!
Agree with a comment or answer? Like () to up-vote the contribution!
I am not sure if it is, but I would. It improves readability, and it will make it more convenient in the event that you do would like to call it in the future.
The question (1) asks to assign an “id” to the new element created, but the “Solution” provided (below) after question (2) does not feature an “id” . I thought the new element was to be added to an existing list?
=======================================================
let newDestination = document.createElement(“li”);
newDestination.innerHTML = “Oaxaca, Mexico”;
document.getElementById(“more-destinations”).appendChild(newDestination);
Is there an OL or UL element in the HTML with id="more-destinations”? That’s what this line is querying. If found, the LI child node is appended to it.
The purpose of script is so we can interact with the user, almost directly. During a session we can hardly be expected to edit the file and upload a revised version for their exclusive use.
Same issue with escaping the x. I’m glad you noticed Wyoming missing the y Now I notice all the y’s are missing! I put the index.html in a text file and opened it in Safari (everything displays) and Chrome (won’t display y, like skscraper). So it’s not the JavaScript at least.
On this lesson there doesn’t seem to be a style.css (that I could edit). So the font is the standard font which Chrome by default uses Times. This can be changed in the Chrome preferences (search for font).
Default (Times) in Chrome Prefs:
and changing to Times Roman works:
Don’t know if this is a Mac issue or something specific to my Mac (font conflict or something).
I developed and redeveloped the code 8 different ways, adding stuff, taking stuff out, rearranging things, changing the HTML, renaming stuff…finally decided to just have the answer GIVEN to me and could not, for the life of me, figure out why it told me I was wrong over and over again.