我有一个下拉菜单,当在另一行的下拉菜单中选择法国时,我想隐藏它。我想隐藏整行,以便隐藏县和下拉菜单。下面是我尝试过的 CSS、JS 以及 JSFiddle 中的相同链接。
<table>
<tr>
<td class="BBFieldCaption DonationCaptureFieldCaption" id="PC1920_DonationCapture1_AddressCtl_lbl_country">
<label id="PC1920_DonationCapture1_AddressCtl_lblCountry" for="PC1920_DonationCapture1_AddressCtl_dd_Country">Country:</label>
</td>
<td>
<select class="BBFormSelectList DonationCaptureSelectList" id="PC1920_DonationCapture1_AddressCtl_dd_Country" onchange="javascript:setTimeout('__doPostBack(\'PC1920$DonationCapture1$AddressCtl$dd_Country\',\'\')', 0)" name="PC1920$DonationCapture1$AddressCtl$dd_Country">
<option value=""></option>
<option value="Australia">Australia</option>
<option value="Bahamas">Bahamas</option>
<option value="Bermuda">Bermuda</option>
<option value="Canada">Canada</option>
<option value="France" selected="selected">France</option>
<option value="Germany">Germany</option>
<option value="Italy">Italy</option>
</select>
</td>
</tr>
<tr>
<td class="BBFieldCaption DonationCaptureFieldCaption" id="PC1920_DonationCapture1_AddressCtl_lbl_countyUK">
<label id="PC1920_DonationCapture1_AddressCtl_lblCountyUK" for="PC1920_DonationCapture1_AddressCtl_dd_CountyUK">County:</label>
</td>
<td class="taLeft BBFieldControlCell DonationCaptureFieldControlCell" id="PC1920_DonationCapture1_AddressCtl_ctl_countyUK">
<select class="BBFormSelectList DonationCaptureSelectList" id="PC1920_DonationCapture1_AddressCtl_dd_CountyUK" name="PC1920$DonationCapture1$AddressCtl$dd_CountyUK">
<option value="" selected="selected"></option>
<option value="Alcorn">Alcorn</option>
<option value="Alexander">Alexander</option>
</select>
</td>
</tr>
</table>
我已尝试通过添加以下内容来使用 jquery 执行此操作,但无法使其正常工作:
$(document).ready(function() {
$('#PC1920_DonationCapture1_AddressCtl_dd_Country').change(function() {
PC1920$DonationCapture1$AddressCtl$dd_Country = $('#PC1920_DonationCapture1_AddressCtl_dd_Country').val();
$('PC1920_DonationCapture1_AddressCtl_ctl_countyUK').hide();
if (PC1920$DonationCapture1$AddressCtl$dd_Country == 'France')
{
$('PC1920_DonationCapture1_AddressCtl_ctl_countyUK').hide();
}
});
});
我无法直接访问表单的 HTML,这是使用 CMS 系统。我也将此添加到 JSFiddle,任何帮助将不胜感激。谢谢!在此处查看 JSFiddle:http: //jsfiddle.net/jelane20/qG2bT/7/