当我点击按钮时,我想要隐藏具有Val
作为文本或属性值的元素。基本上我想要的是点击搜索文档按钮后我向服务器发送新请求我想隐藏包含branch
或company
<ul class="ui-autocomplete ui-front ui-menu ui-widget ui-widget-content">
<li class="search-documents-btn ui-menu-item">
Search from documents »
</li>
<li class="search-category ui-menu-item" id="ui-id-112" tabindex="-1">
Companies
</li>
<li aria-label="COMPANY : AUTO EDIBUYER" class="ui-menu-item" id="ui-id-113" tabindex="-1">
AUTO EDIBUYER
</li>
<li aria-label="COMPANY : AUTO EDISUPPLIER" class="ui-menu-item" id="ui-id-114" tabindex="-1">
AUTO EDISUPPLIER
</li>
<li class="search-category ui-menu-item" id="ui-id-122" tabindex="-1">
Branches
</li>
<li aria-label="BRANCH : AUTO WEBSUPPLIER 4DOC" class="ui-menu-item" id="ui-id-127" tabindex="-1">
AUTO WEBSUPPLIER 4DOC
</li>
<li aria-label="BRANCH : AutoTest" class="ui-menu-item" id="ui-id-128" tabindex="-1">
AutoTest
</li>
</ul>
答案 0 :(得分:1)
你需要使用属性包含
$( "li[aria-label*='COMPANY']" ).hide();
$( "li:contains('Branches')" ).hide();
$( "li:contains('Companies')" ).hide();
这是一个fiddle