bootstrap 隐藏下拉框

濮阳鸿卓
2023-12-01

最近在用select的时候,需要隐藏下拉框,而且是多选

<select id="selectSendMsgType" name="selectSendMsgType" multiple="multiple"   class="chosen-select-comp" >
            </select>

bootstrap中select 代码生成如下

<select id="selectSendMsgType" name="selectSendMsgType" multiple="multiple" class="chosen-select-comp" style="display: none;">
<option value="4" selected="">5675</option>
<option value="2" selected="">12</option>
<option value="342" selected="">何4</option>
<option value="5" selected="">王83</option>
<option value="54" selected="">杨1</option>
<option value="645" selected="">王</option>
<option value="65" selected="">吴7</option>
<option value="343" selected="">蔡</option>
<option value="34" selected="">王65</option>
<option value="99" selected="">潘1</option>
<option value="88" selected="">吴7</option>
<option value="77" selected="">蔡</option>
<option value="66" selected="">王</option>
<option value="55" selected="">潘1</option>
</select>

 

<div class="chosen-container chosen-container-multi" style="width: 100%; display: none;" title="" id="selectSendMsgType_chosen">  
<ul class="chosen-choices">  
        <li class="search-choice"><span>657</span><a class="search-choice-close" data-option-array-index="0"></a>
</li>  
        <li class="search-choice"><span>丽1</span><a class="search-choice-close" data-option-array-index="1"></a>  
       </li>
<li class="search-choice"><span>良</span><a class="search-choice-close" data-option-array-index="2">  
       </a></li><li class="search-choice"><span>83</span><a class="search-choice-close" data-option-array-index="3"></a>
</li>  
   <li class="search-choice"><span>霞1</span><a class="search-choice-close" data-option-array-index="4"></a></li>  
   <li class="search-choice"><span>宾</span><a class="search-choice-close" data-option-array-index="5"></a></li>  
  <li class="search-field"><input type="text" value="Select Some Options" class="" autocomplete="off" style="width: 25px;"></li>  
</ul>  
<div class="chosen-drop" style="display: none;></span>  
<ul class="chosen-results">  
<li class="result-selected" data-option-array-index="0" style="">undefined</li>  
<li class="result-selected" data-option-array-index="1" style="">汤1</li>  
<li class="result-selected" data-option-array-index="2" style="">何</li>  
<li class="result-selected" data-option-array-index="3" style="">王3</li>  
<li class="result-selected" data-option-array-index="4" style="">春1</li>  
<li class="result-selected" data-option-array-index="5" style="">王</li>  
<li class="active-result" data-option-array-index="6" style="">吴丹7</li>  
<li class="active-result" data-option-array-index="7" style="">蔡媛</li>  
<li class="active-result" data-option-array-index="8" style="">王65</li>  
<li class="active-result" data-option-array-index="9" style="">潘1</li>  
<li class="active-result" data-option-array-index="10" style="">丹7</li>  
<li class="active-result" data-option-array-index="11" style="">蔡</li>  
<li class="active-result" data-option-array-index="12" style="">王65</li>  
<li class="active-result" data-option-array-index="13" style="">金1</li>  
</ul>  
</div>  
</div>
  其中下拉菜单正好是<div class="chosen-drop" style="display: none;">这块 所以只需要把这个隐藏就好 实现代码:
jQuery(".chosen-drop").hide();

 

 类似资料: