在下面的tr和td中动态地来自一个函数 -
<table class="adm-detail-content-table edit-table" id="edit1_edit_table">
<tr>
<td class="adm-detail-content-cell-l" width="40%"> Type:</td>
<td class="adm-detail-content-cell-r" width="60%">
<select name="UF_TYPE">
<option value="">Select type</option>
<option value="26" selected="">Complaint</option>
<option value="27">Request</option>
<option value="28">Query</option>
</select>
</td>
</tr>
</table>
答案 0 :(得分:0)
这会隐藏每个tr
作为孩子的select
: -
$('table tr').each(function(){
if($(this).find('select[name="UF_MODE"]').length || $(this).find('select[name="UF_TYPE"]').length){
$(this).hide();
};
});
实施例: -
$('table tr').each(function(){
if($(this).find('select[name="UF_MODE"]').length || $(this).find('select[name="UF_TYPE"]').length){
$(this).hide();
};
});
&#13;
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<table class="adm-detail-content-table edit-table" id="edit1_edit_table">
<tr>
<td class="adm-detail-content-cell-l" width="40%"> Type:</td>
<td class="adm-detail-content-cell-r" width="60%">
<select name="UF_MODE">
<option value="">Select type</option>
<option value="26" selected="">Complaint</option>
<option value="27">Request</option>
<option value="28">Query</option>
</select>
</td>
</tr>
<tr>
<td class="adm-detail-content-cell-l" width="40%"> Type:</td>
<td class="adm-detail-content-cell-r" width="60%">
<select name="UF_TYPE">
<option value="">Select type</option>
<option value="26" selected="">Complaint</option>
<option value="27">Request</option>
<option value="28">Query</option>
</select>
</td>
</tr>
<tr>
<td class="adm-detail-content-cell-l" width="40%"> Type:</td>
<td class="adm-detail-content-cell-r" width="60%">
<select name="UN_TYPE">
<option value="">Select type</option>
<option value="26" selected="">Complaint</option>
<option value="27">Request</option>
<option value="28">Query</option>
</select>
</td>
</tr>
</table>
&#13;
答案 1 :(得分:0)
$(function(){
$('.adm-detail-content-cell-r select').hide();
});
&#13;
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<table class="adm-detail-content-table edit-table" id="edit1_edit_table">
<tr>
<td class="adm-detail-content-cell-l" width="40%"> Type:</td>
<td class="adm-detail-content-cell-r" width="60%">
<select name="UF_TYPE">
<option value="">Select type</option>
<option value="26" selected="">Complaint</option>
<option value="27">Request</option>
<option value="28">Query</option>
</select>
</td>
</tr>
</table>
&#13;
如果你想要隐藏完整的行,请使用它:
$(function(){
$('tr:first-child').hide();
});
$(function(){
$('tr:first-child').hide();
});
&#13;
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<table class="adm-detail-content-table edit-table" id="edit1_edit_table">
<tr>
<td class="adm-detail-content-cell-l" width="40%"> Type:</td>
<td class="adm-detail-content-cell-r" width="60%">
<select name="UF_TYPE">
<option value="">Select type</option>
<option value="26" selected="">Complaint</option>
<option value="27">Request</option>
<option value="28">Query</option>
</select>
</td>
</tr>
</table>
&#13;
答案 2 :(得分:0)
Jquery为您提供selector
和hide()
功能。您只需要使用要隐藏的jquery selector
选择元素,然后应用hide()
函数进行隐藏。 hide()
函数将显示阻止该元素,您也可以使用jquery remove()
函数将其删除。
$('.adm-detail-content-table tr td.adm-detail-content-cell-r select').hide();
&#13;
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<table class="adm-detail-content-table edit-table" id="edit1_edit_table">
<tr>
<td class="adm-detail-content-cell-l" width="40%"> Type:</td>
<td class="adm-detail-content-cell-r" width="60%">
<select name="UF_TYPE">
<option value="">Select type</option>
<option value="26" selected="">Complaint</option>
<option value="27">Request</option>
<option value="28">Query</option>
</select>
</td>
</tr>
</table>
&#13;