簡體   English   中英

選中單選按鈕時-顯示選擇標簽部分

[英]When radio button is checked - show select tag section

所以我正在使用插件Contact Form 7 for WordPress,並且我有兩個帶有單選按鈕的表單:

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

選中我是投資者按鈕時,需要在其下方顯示以下下拉列表:

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

當選中另一個按鈕時,我需要此下拉菜單顯示:

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

有沒有簡單的方法可以在WordPress中做到這一點?

我已經在這里使用此方法解決了問題,並且效果很好:)

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();
            }                                                            
});
});

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM