Converting Checkbox function to Radio Button with Javascript

In this article, we will discuss a little about how to turn a Checkbox into a Radio using Javascript.
checkbox
Background

The use of the :checked selector is compatible in every browser. This selector selects input elements of type radio or checkbox.

Problem

However, designers may be confused. what type will be used? whether the input type radio or checkbox type.

Inspiration

The reason is that if the input element has different radio name type, then its function is the same as input with checkbox type.

Radio only functions as a chooser of course if the names are the same to form an array of keys. On the other hand, input of type checkbox is unaffected by its name , forming an array of values. As an alternative. then element input=Radio can only use input=checkbox. just use the script below:
More about this source textSource text required for additional translation information
Send feedback
Side panels