Eager to have your feedback on my JS, surely there is a way to write less code
Sahiru
@bhatsahil13579All comments
- @cryptosossoSubmitted almost 2 years ago@bhatsahil13579Posted almost 2 years ago
Nice job cryptososso 😀
Here are some feedbacks
Your all buttons are having borders you can remove them simply by adding ( border : none)
In Js Part :
i see that you have added event Listener for each button separately but you can do it by only adding event Listener one time through ForEach method like this :
btn.forEach(elements => elements.addEventListener("click", () => { } })
but make sure you have selected that element by querySelectorAll
and also there is no need for score1 , score2 like that you can simply do it like this :
btn.forEach(elements => {`` elements.addEventListener("click", () => {`` rateScore.textContent = elements.textContent } })
and i can click submit button without submitting rating to stop that add disabled attribute to your all rating buttons and then in js you can remove that attribute if the click is true like this
btn.forEach(elements => { elements.addEventListener("click", (task) => { rateScore.textContent = elements.textContent if (task) { btn.removeAttribute("disabled" ) } }) } })
hope it will help you 😀😀
Marked as helpful0 - @AbrahamTheWebDeveloperSubmitted about 2 years ago
I struggled to try to get the picture block to expand a little and I am still trying to understand CSS.
@bhatsahil13579Posted about 2 years ago.card { width : 700px }
it will expand picture container and card info container both
0