Latest solutions
Latest comments
- @RuFuRuSubmitted over 2 years ago@achrustowskiPosted over 2 years ago
Hi RuFa,
Congrats on your solution! It looks great and it's a nice touch to have a prompt for Custom tip value :)
As for improvements, you have some repetitions in you JS code, you could put
gridButtons.forEach(btn => { btn.setAttribute('style', 'pointer-events: auto'); btn.classList.remove('btn-clicked'); });
andbutton.classList.add('btn-clicked'); button.setAttribute('style', 'pointer-events: none');
inside of a function and call it whenever you need to use it. This will clean up the code a little bit and make it more readable.Lastly, completely UI thing, looks like your 15% button is clicked by default, not sure if this is intended, just my observation.
Hope this help! Adam
Marked as helpful1 - @SouiciaSubmitted over 2 years ago@achrustowskiPosted over 2 years ago
Hi Leo!
I really like your solution, logic works as expected and everything does it's job as it should, well done! :)
As for reducing the amount of
getElementById
I don't think there is any other way if you're using vanilla JavaScript (I've done my solution similar way to yours). Only thing I'd change in order to make your life easier IF you had to edit your JS code, I'd putthrowErrorMessage
selectors into variables same as you did for buttons and inputs.Great job!
Marked as helpful1 - @achrustowskiSubmitted over 2 years ago@achrustowskiPosted over 2 years ago
Hi @correlucas,
Thanks very much for your feedback. I indeed have been using semantic elements in my previous solutions, but then what I would get is accessibility issues.. not sure why.
Any idea why when I use semantic elements I'm getting accessibility issues?
Cheers, Adam
0