@darryncodes
Posted
Hi Zoulander,
I think your question would be better resolved using semantic html and css instead of JavaScript.
- instead of a using a list consider
<input type="radio">
this has many more built in accessibility benefits and makes styling the input with:focus
easier achieving the 'active' state - you can also tab into the input and use your arrow keys to see the focus state
- styling radio inputs are a little trickier but something really worthwhile
Extended content:
- MDN - <input type="radio">
- MDN - :focus
- you should look into using
<form>
,<fieldset>
,<label>
and<input>
's too - when using the
<form>
you'll need to consider the submit event instead ofonClick
I hope that helps, any questions let me know.
Happy coding!
Marked as helpful
@AlexDDevv
Posted
Thank you for your response, I will do that ! Have a good day !