0
What I want to do is very simple, only it’s not going.
HTML
<select name="id_tipo_contacto" id="id_tipo_contacto">
<option value="empresa">Alugar Filmes/Séries</option>
<option value="casamento">Vender Filmes/Séries</option>
</select>
<div id="empresa" class="formulario"><h2 style=" color: #21BF16;
font-weight: bolder;">R$07,99 Por dia.</h2></div>
<div id="casamento" class="formulario" style="display:none;">R$70,00.</div>
jQuery
<script src="js/jquery-3.2.1.min.js">
var $j = jQuery.noConflict();
$j("#id_tipo_contacto").on('change', function(){
$j(".formulario").hide();
$j('#' + this.value).show();
});
</script>
Igor, your code works: https://jsfiddle.net/Sergio_fiddle/srpesr8m/ maybe you have the script before HTML? put it at the bottom of the page.
– Sergio
Could detail the purpose of the code and what doesn’t work?
– Renato Junior
Ta at the end of everything, can be the version of jQuery?
– Igor Rinke
Create an example that reproduces the error (we can directly run) using JSFIDDLE. The way it is, there’s no way we can know where the fault is.
– Guilherme Nascimento
I would simply like to present the values according to the selected option. I already put it under all html, I’ve put it outside the body, inside and nothing.
– Igor Rinke
It does not show any error on the console, it just doesn’t work.
– Igor Rinke
What doesn’t work?
– Renato Junior
It does not display or hide values..
– Igor Rinke
I will send you the link to my entire file, without css or anything, just to see https://jsfiddle.net/cL629s9j/
– Igor Rinke
@Igorrinke you can’t use
<script src="js/jquery-3.2.1.min.js">
with script inside... you must have 1 tag to get jQuery<script src="js/jquery-3.2.1.min.js"></script>
and another to have Javascript inside:<script>....etc....</script>
– Sergio