S
S
sitev_ru2015-09-28 13:42:59
JavaScript
sitev_ru, 2015-09-28 13:42:59

How to select a radio button by clicking on the text or image next to it?

I am writing an interface where the choice of site design is carried out using radio buttons with a caption and pictures

1deb5996f3584a3ca312f7d1cd91ea34

How to make a choice not only by clicking on the radio buttons, but also by clicking on the text and pictures?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
Dmitry Novikov, 2015-09-28
@sitev_ru

wrap the radio button and clickable content in a label

<label> <input type="radio"> <img src="..."> Текст</label>

S
Sharov Dmitry, 2015-09-28
@vlom88

https://jsfiddle.net/w39qcx4c/
the simplest option is using the label tag
if something is more specific then js

L
lyeskin, 2015-09-28
@lyeskin

On JS

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question