隐藏、显示标签
根据input下拉选框所选择的值,判断是否需要显示或者隐藏。
body代码块
<td>是否限制</td>
<td><input type="select2" class="style-select2" name="sfxz" id="sfxz" value="02" onclick="display()" required/></td></tr>
<tr id="hides">
<td>时间</td>
<td><input name="sfxz1" id="sfxz1" type="text" class="input-style form-control"/></td>
<td>购物数量</td>
<td><input name="sfxz2" id="sfxz2" type="text" class="input-style" required/></td>
</tr>
script代码块
function display(){ //获取
var displayPd=$("#sfxz").val();
if (displayPd=="02"&&displayPd!=null){
$("#hides").show();
}else if(displayPd=="01"&&displayPd!=null){
$("#hides").hide();
}
}