Perform onclick event on a radio button of contact form 7 wordpress

0

I'm doing a form and what I want to do is click on a radio button to fill out other sections to fill out if they do not click, I can do this with javascripot and the onclick event but in contact form 7 as I would do it? since the onclick="" does not work.

I have this code in javascript

function mostrarCiudad(){

if (document.getElementById('notariosno').click == true;) {

document.getElementById('ciudadnotario').style.display='block';
} else {

document.getElementById('ciudadnotario').style.display='none';
}
}

Thanks

    
asked by AitorUdabe 17.01.2017 в 10:59
source

2 answers

0

you can do it with jQuery. 1st) takes the HTML code of the form in a separate HTML page to test 2nd) on that html page, create the jquery script to control the onclick of the radiobutton and do what you have to do (hide the fields you want) 3rd) Once you work in local, take the script you have created and put it in the footer.php file of your template and ready.

I do not know if Contact form allows you to control that, but if you can not find other components that allow logic in the fields.

Let's see if it helps you

    
answered by 17.01.2017 в 13:17
0

It's already fixed.

What I changed was checked and I removed the; after the true. the code was the following:

function mostrarCiudad(){

if (document.getElementById('notariosno').checked == true) {

document.getElementById('ciudadnotario').style.display='block';
} else {

document.getElementById('ciudadnotario').style.display='none';
}
}
    
answered by 18.01.2017 в 12:46