@EFEELE
Posted
Good job!!! I share with you how I did the Js part
With innerHTML you can replace the content of an HTML element and thus make the final message ** dynamic**
let optionSelected;
const container = document.getElementById('container');
const thanks = document.getElementById('thank-state');
const showValue = document.getElementById('our-selection');
function checkValue(){
const options = document.getElementsByName('option');
for (let i=0; i < options.length; i++ ){
if(options[i].checked){
optionSelected = options[i].value
}
}
if(optionSelected){
container.style.display = 'none';
thanks.style.display = 'flex';
showValue.innerHTML = 'You selected ' + optionSelected + ' of 5';
}else{
alert('You have not selected any options')
}
}
I share my repository with you in case you like to test: GitHub Repo
I hope that helps!!
@VCarames
Posted
@EFEELE
Unfortunately, that is the incorrect way of doing this challenge. Since a form
is absolutely necessary to create this challenge all you need to do is add an eventListener
to the form
as a submit
to obtain the value you will add const rating = form.rating.value;
(this assumes that your radios
are named "rating").
Essentially, it should look like this;
form.addEventListener("submit", (e) => {
e.preventDefault();
const rating = form.rating.value;
userSelection.textContent = `You selected ${rating} out of 5`;
(Any additional code)
});
@EFEELE
Posted
@VCarames
Excellent friend, thank you very much!!
@jaalzu
Posted
@VCarames i still can't do it :( What sould i put in the html ?
@VCarames
Posted
@jaalzu
You haven't update the code (I did not see any changes to your GitHub)... I can't help if I don't see any updates.