Contact Form 7 wordpress DOUBT

0
 <label> Porque te gusta nuestro negocio?
 [select gustar 
 "Es una buena alternativa para emprender" 
 "Quiero ampliar mi negocio actual" 
 "Me gustan las facilidades que ofrecen" 
 "Otros"] </label>

Good to root this field in a form that I have with contact form 7, is there any way for the user to press "others" create a textarea for the user to write?

Now I have this in the code

<label> Porque te gusta nuestro negocio?
[select gustar id:result  "Es una buena alternativa para emprender" "Quiero ampliar mi negocio actual" "Me gustan las facilidades que ofrecen" "Otros"] </label>

<script type="text/javascript"> 
function textarea(element){
document.getElementById("oculta").style.display = element=="otros"?"block";}                 

</script> 
<label style="display: none;"> [text text-889 id:oculta] </label>

update:

<script type="text/javascript"> 
function gettextarea(){ 
var select = document.getElementById("result");
var selectedValue = select.options[select.selectedIndex].text;
if(selectedValue=="Otros"){
    document.getElementById("textarea").style.display="block";
}else{
    document.getElementById("textarea").style.display="none";
}}
</script>

<label onchange="gettextarea()"> Porque te gusta nuestro negocio?
[select gustar id:result  "Es una buena alternativa para emprender" "Quiero ampliar mi negocio actual" "Me gustan las facilidades que ofrecen" "Otros"] </label>

<label id="textarea" style="display: none;"> [text text-889] </label>
    
asked by Caldeiro 01.08.2018 в 13:41
source

1 answer

1

With JQuery:

$(function(){
  $("select[name=reason]").change(function(){
    if($(this).val() == 'Other')
        $('#txtarea').show();
    else
        $('#txtarea').hide();
  });
});

Look here: link

    
answered by 02.08.2018 / 14:26
source