选择 option 决定表格 tr 是否隐藏

一、设置 tr   style="display:none;

 <tr id="img" style="display:none;">
                                <td style="width:75px;text-align: right;padding-top: 13px;">图片:</td>
                                <td><input onmouseover="showTU('IMAGE','yulantu1');" onmouseout="hideTU('yulantu1');" type="text" name="IMAGE" id="IMAGE" value="${pd.IMAGE}" maxlength="100" placeholder="这里输入图片" title="图片" style="width:88%;"/>
                                    <div class="yulantu" id="yulantu1"></div>
                                    <a class="btn btn-xs btn-info" style="margin-top: -5px;" title="选择" onclick="xuanTp('IMAGE');">选择 </a>
                                </td>
                            </tr>

二 、添加  jquery控件  <script type="text/javascript" src="static/js/jquery.tips.js"></script>

jquery 方法

$(function(){
            var select=$("select[name=MODEL]").val();
            
            if(select==2 ){
                $("tr[id=img]").show();
            }else{
                $("tr[id=img]").hide();
            }
            $("select[name=MODEL]").change(function(){
                var value=$(this).val();
                if(value==2 ){
                    $("tr[id=img]").show();
                }else{
                    $("tr[id=img]").hide();
                }
            });
        });

猜你喜欢

转载自blog.csdn.net/qq_33709529/article/details/88789043
tr