I want to toggle some fields depending on what the visitor chooses at this page http://ift.tt/1rF8gYS so I created a dropdown menu with the id puesto and the fields to toggle with the class condicional then I added this script
document.getElementById("puesto").onchange = CamposOcultos(document.getElementById("puesto").value);
function CamposOcultos(valor){
if (valor == "Modelo" or valor == "Promotor/a"){
for (var i=0;i<document.getElementsByClassName('condicional').length;i+=1){
document.getElementsByClassName("condicional")[i].style.display="block";}
else{
for (var i=0;i<document.getElementsByClassName('condicional').length;i+=1){
document.getElementsByClassName("condicional")[i].style.display="none";} }
}
But I get the following error when I try to load the function in the chrome console
Uncaught SyntaxError: Unexpected identifier(…)
Any idea how can I make it work ?
Thanks !
PS: I am using Contact Form 7 on WordPress
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire