Design comparison
Solution retrospective
How can I make the submit button to be inactive until you click a rating?
Community feedback
- @khaya05Posted about 2 years ago
Hi David, To disable your button you can use the
disabled
attribute. This is a boolean attribute. when present it specifies that the button should be disabled, thus, will make your button un-Clickable.Also, you should have different styles for disabled buttons i.e
button:disabled{ cursor:not-allowed; background-color: inherit; outline: 1px solid white; }
Then you can use javascript to remove or add the
disabled
attribute i.erates.forEach(element => { element.addEventListener("click", () => { rating.innerHTML = element.innerHTML; submit.disabled = false; } ) });
Don't forget to disable the submit button when users click the rate again button
rateAgain.addEventListener("click", function () { thankDiv.classList.add("hidden"); rateDiv.style.display = "block"; submit.disabled = true } )
Hope this answers your question๐๐๐
1 - @godmayhem7Posted about 2 years ago
wow your code is not that bad but i think you should have a deeper understanding of styles, your button are supposed to be circular not oval and also try checking out different approach to your codes i think that will be helpful and also do some reviews on your code and check how you can better it i think this will be very helpful to you in the future hope this feedback was helpful ๐๐
0
Please log in to post a comment
Log in with GitHubJoin our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord