0
I have the following code:
<form>
<input type="radio" id="div1" name="consulta[]" value="1">Opção 1
<input type="radio" id="div2" name="consulta[]" value="2">Opção 2
<input type="submit" value="Registrar">
</form>
<div id="m1" style="display:none">
DIV 1
</div>
<div id="m2" style="display:none">
DIV 2
</div>
I need the DIV 1 to appear (changing its display in css) only when the radio div1 is clicked, and the same for the DIV 2.
What’s the simplest way to do that?
you are using some framework that has auxiliary classes like "Hidden" ?
– RickPariz
use jquery-3.2.1, but I can’t tell which classes it hides
– ARodrigues
I meant bootstrap.. materialize
– RickPariz
no. I do not use any framework of this type
– ARodrigues
Have you tested the function checked? It would look like this: if(Document.getElementById('div1').checked) { <div id="M1" style="display:None"> DIV 1 </div> }
– Theotonio