Skip to content
Advertisement

Getting values from radios, how to optimize it?

is there a better way to optimize my code and to avoid duplication

JavaScript
JavaScript

Advertisement

Answer

You can store the values directly inside the option element as data-* attributes and read them in the event handler

JavaScript
JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement