How to mark a radio input when clicking a DIV?

Asked

Viewed 118 times

1

The question is self-explanatory.

I have a form with 3 divs, each div has a img and a radio, would like that when clicking on the imgs, the radio that this in the same div of img click be marked.

Ps: I believe it is simple to resolve with JS. If you can show me a North where to start studying JS(from scratch), I thank.

  • 1

    Start by putting what you already have of html/css code that already helps...

1 answer

3


Enclose your image with a label and attribute it to the same id of radio that already solves your problem:

<input name="teste" type="radio" id="test1" />
<label for="test1">
    <img src="path-da-imagem" />
</label>
  • Perfect. You can tell me JS study material for those who already work with HTML and CSS, but you don’t get anything from js?

  • @Amauri https://developer.mozilla.org/en-US/docs/Web/JavaScript

  • So @Amauri, my study material is Google even kkk, I’m not very good javascript tbm but the link from Valdeir will help you.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.