Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialkito M
2,767 PointsHaving trouble getting my 4th answer to appear..
It has to be something in here.. the 4th question appears on the mash game but the when i hit submit only 3 original questions are filled.
function fill_in_answers(answers) {
// Find the spans that need filled
var home = document.querySelector('#home'); // This says make a new variable and find the HTML tag that has the ID of "home"
var profession = document.querySelector('#profession');
var pet = document.querySelector('#pet');
var location = document.querySelector('#location');
var wear = document.querySelector('#wear');
// Fill them with the provided answers
home.innerText = answers['mash'];
profession.innerText = answers['profession'];
pet.innerText = answers['pet'];
location.innerText = answers['location'];
wear.innerText = answers['wear'];
home.innerHTML = answers.mash; // Change the content of the element in the HTML doc with the id "home" to the "mash" value in answers
profession.innerHTML = answers.profession; // Change the content of the element in the HTML doc with the id "career" to the "career" value in answers
pet.innerHTML = answers.pet;
location.innerHTML = answers.location;
}
function handle_submission(evt) {
evt.preventDefault(); // Stop the form from reloading the page
evt.stopPropagation(); // Stop the form from reloading the page
// Build up our answers object
var answers = {
'mash': mash_choice(),
'profession': get_answer('profession'),
'pet': get_answer('pet'),
'location': get_answer('location')
'wear': get_answer('wear')
}
1 Answer
Steven Parker
231,248 PointsI couldn't try it without a link to your workspace, but did you perhaps forget to add this:
wear.innerHTML = answers.wear;
...at the end of function fill_in_answers?
Chyno Deluxe
16,936 PointsChyno Deluxe
16,936 Points//Fixed Code Presentation - how to post code