我是学生,我在项目帖子上遇到问题。我正在寻找基于parentCatId
和catId
的隐藏节目脚本!
这是我试图隐藏或显示的div! div class="item-post-lot-area"
<div class="item-post-lot-area">
<label for="s_lotsize">
<?php _e('Lot Area', 'ctg_housing'); ?>
</label>
<div class="row collapse prefix-radius">
<div class="item-post-area-sign columns">
<span class="prefix"><?php echo osc_get_preference('metric','ctg_housing_theme'); ?></span>
</div>
<div class="item-post-area-number columns">
<input type="number" name="s_lotsize" id="s_lotsize" value="<?php if(isset($housingOut['s_lotsize'])) { echo $housingOut['s_lotsize'];} ?>" >
</div>
</div>
</div>
我试试的是什么!
加载页面时, item-post-lot-area
字段将全部显示!
在选择以下parentCatId
和catId
<option value="28">Vacation</option>
<select id="catId" name="catId" class="valid">
<option value="28">Select Subcategory</option>
<option value="29">Pension House</option>
<option value="30">Inn / Motel</option>
<option value="31">Hotel & Resort</option>
</option>
</select>
<select id="catId" name="catId" class="valid">
<option value="32">Select Subcategory</option>
<option value="33">Space</option>
<option value="34">Office</option>
<option value="35">BPO</option>
<option value="36">Economic</option>
</select>
有人能解释我怎么做吗?
由于
答案 0 :(得分:0)
您可以使用Jquery显示或隐藏,
<script>
$( "select" )
.change(function() {
$( "select option:selected" ).each(function() {
$("#item-post-lot-area").hide();
});
})
</script>