Pergunta

So I'm using the plugin Contact Form 7 for WordPress, and I have this form with 2 radio buttons:

<input type="radio" name="investorlandlord" value="I'm an Investor">
<input type="radio" name="investorlandlord" value="I'm a Landlord" tabindex="1">

When the I'm an investor button is checked I need the following dropdown to appear under it:

<select name="finance" class="wpcf7-form-control wpcf7-select" id="finance"><option value="Finance Available">Finance Available</option>...</select>

and when the other button is checked the I need this dropdown to appear:

<select name="properties" class="wpcf7-form-control wpcf7-select" id="properties"><option value="Number of Properties">Number of Properties</option>...</select>

Is there any easy way to do this in WordPress?

Foi útil?

Solução

I've solved the problem using this right here and it works perfect :)

jQuery(function(){
               jQuery("input[name=investorlandlord]").change(function(){          


            if ($(this).val() == "I'm a Landlord") {
            jQuery("#properties").slideDown()
            }
            else {
            jQuery("#properties").slideUp();
            }                                                            
       });
    });
jQuery(function(){
        jQuery("input[name=investorlandlord]").change(function(){          


            if ($(this).val() == "I'm an Investor") {
            jQuery("#finance").slideDown()
            }
            else {
            jQuery("#finance").slideUp();
            }                                                            
});
});
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top