0
Guys good afternoon.
How to do a javascript function to get the input value and according to the input redirect to the link I want.
Turma 1 - Option 1
Turma 2 - Option 2
Link turma1 ex: google.com
Link turma2 ex: yahoo.com.br
I want my button to grab the link according to the choice option.
How do I do ?
<div class="escolha-turma">
<input type="radio" class="radiu" id="turma1" value="google.com">
<div class="col-md-5 box">
<strong>Inicio</strong>
<span>08/05/2018</span>
</div>
<div class="col-md-5 box">
<strong>Termino</strong>
<span>08/05/2018</span>
</div>
</div>
<div class="escolha-turma">
<input type="radio" class="radiu" id="turma2" value="yahoo.com.br">
<div class="col-md-5 box">
<strong>Inicio</strong>
<span>08/05/2018</span>
</div>
<div class="col-md-5 box">
<strong>Termino</strong>
<span>08/05/2018</span>
</div>
</div>
<a href="#">Pega o link do input radio escolhido</a>
I tested here on the site worked, but I played on my file on the server and it didn’t work, have to call some library? thanks
– Guilherme Mendes
No library required, it’s pure Javascript.
– Sam
I’ll update the answer.
– Sam
I put a class in <a>, maybe that’s the error. Take a look at the reply update.
– Sam
Uncaught Typeerror: Cannot read Property 'querySelectorAll' of null. When you call the class '.radiu', you presented this error on the console
– Guilherme Mendes
You have to put the code after the HTML.
– Sam
Now it’s gone, thank you very much for your attention!
– Guilherme Mendes