How to change the look of the default switch, not the functionality?

In the form, I have two Yes and No radio buttons . I want to change the look of the default radio buttons

enter image description hereenter image description here

to like it.

enter image description here

Edit: I would like to change the buttons radioto anchor <a>if JavaScript is enabled, if it is not easy to change the appearance of the default radio station via css.

+3
source share
2 answers

The easiest way? Set the images as labels with an attribute forpointing to the radio buttons. Then set the switches todisplay:none;

<input type="radio" name="radio[1]" /><label for="radio[1]"><img src="/yes.png"></label>
<input type="radio" name="radio[2]" /><label for="radio[2]"><img src="/no.png"></label>

p.s. HTML, javascript. - CSS (: hover ..) .

UPDATE:

, , . for , , for. for id .

+5

, <radio>, , , jQuery . , .

+2

Source: https://habr.com/ru/post/1794780/


All Articles