<form id="jtable-edit-form" class="jtable-dialog-form jtable-edit-form">
<div class="jtable-input-field-container">
<div class="jtable-input-label">Type</div>
<div class="jtable-input jtable-text-input">
<input class="" id="Edit-configType" type="text" name="configType">
</div>
</div>
<div class="jtable-input-field-container">
<div class="jtable-input-label">Key</div>
<div class="jtable-input jtable-text-input">
<input class="" id="Edit-configKey" type="text" name="configKey">
</div>
</div>
<div class="jtable-input-field-container">
<div class="jtable-input-label">Value</div>
<div class="jtable-input jtable-text-input">
<input class="" id="Edit-configValue" type="text" name="configValue">
</div>
</div>
<div class="jtable-input-field-container">
<div class="jtable-input-label">Description</div>
<div class="jtable-input jtable-text-input">
<input class="" id="Edit-description" type="text" name="description">
</div>
</div>
我需要隐藏4个div中的1个div。我想只隐藏具有内部div作为值的div&#39; Key&#39;。
请注意,我不允许更改HTML内容。我可以为它编写Jquery。
答案 0 :(得分:2)
你可以试试这个:
$( "div.jtable-input-label:contains('Key')" )
.closest( "div.jtable-input-field-container" )
.css( "display", "none" );
答案 1 :(得分:1)
因为ID在文档上下文中必须是唯一的,所以您应该定位包含#Edit-configKey
DIV的特定父元素:
$('#Edit-configKey').closest('.jtable-input-field-container').hide();
答案 2 :(得分:1)
试试这个,
$("#jtable-edit-form .jtable-input-label:contains('Key')" ).parent().hide();
请参阅此jsfiddle https://jsfiddle.net/cL4wsL3q/1/
答案 3 :(得分:1)
试试此代码
$(document).ready(function(){
$( "div.jtable-input-label:contains('Key')" ).parent().hide();
});
希望这会对你有所帮助。