0
I’m wanting to open Check() and open it when the select option is pressed.
<select>
<option href='javascript:;' onchange="abrirVit();" value="canto">Vitória - Praia do Canto</option>
<option href='javascript:;' onchange="abrirVelha();" value="velha">Vila Velha</option>
</select>
SCRIPT:
<script type="text/javascript">
$(function(){
function abrirVit(){
$("#backForm").css("display","block").stop().animate({"opacity":"1"},200);
setTimeout(function(){
$("#formContact").css("display","block").stop().animate({"opacity":"1"},200);
},150);
};
</script>
<script type="text/javascript">
$(function(){
function abrirVelha(){
$("#backForm").css("display","block").stop().animate({"opacity":"1"},200);
setTimeout(function(){
$("#formContact").css("display","block").stop().animate({"opacity":"1"},200);
},150);
};
</script>
The functions
abrirVit
andabrirVelha
are the same? what is the difference between them?– Sergio
Remove the
$(function(){ ... }
that is around the functions. Not only will this solve the problem but the syntax error that has in your code (should be appearing in the browser console, open to see).– bfavaretto
@Sergio is just for testing, but they will do different things.
– kaiquemix
@bfavaretto I’ll try now
– kaiquemix
@bfavaretto pulled Function {} and still not working.
– kaiquemix
Also took the
};
of the end?– bfavaretto
I only let Function open(){ ... }
– kaiquemix
Your jquery is declared in the header?
– MagicHat
<script type="text/javascript" src="js/jquery-2.0.3.min. js"></script>
– kaiquemix
Ah, I hadn’t noticed, but the
onchange
belongs to select, not to options. You call a function from there and decide what to do based on the current value of select.– bfavaretto
@bfavaretto could answer with an example of how to do please? because I do not know how to call the options for value
– kaiquemix
https://jsfiddle.net/62f6b9tz/
– bfavaretto
@bfavaretto blz.. could you explain this change?? , now how do I make it so that if A is selected it does my function?
– kaiquemix