选择的下拉属性未更新

Chosen dropdown properties not updated

我最近将标准下拉列表更改为包含搜索框的选定下拉列表。 Chosen 提供了根据列表中的项目数定义阈值以禁用搜索栏的可能性。 例如:我不想要搜索栏,因为列表中的项目少于 10 个。 文档说要使用 :

$(".chosen-select").chosen({disable_search_threshold: 10});

但它不适合我。这是我的代码:

<tr class="flavors">
  <td>[brand_list]</td>
  <td>
    <select id="arome0" class="chosen-select"></select>
  </td>
  <td>
    <select id="dropper0" class="chosen-select">
      <option selected="selected" value="type1">type 1</option>
      <option value="type2">type 2-3</option>
    </select>
  </td>
  <td>
    <select id="qtyunit0" class="chosen-select">
      <option value="ml">ml</option>
      <option value="drops">drops</option>
      <option selected="selected" value="perc">%</option>
    </select>
  </td>
  <td>
    <input id="quantity0" class="quantity" type="number" />
  </td>
</tr>

和我的 jquery :

$( document ).ready(function() {
    $("#marque0").attr('class','chosen-select');
    $(".chosen-select").chosen({
        disable_search_threshold: 10,
        no_results_text: "Oops, nothing found!"
    });
    $(".chosen-select").css("overflow", "initial !important");
}); 

你能看出什么不对吗?

尝试:

$(".chosen-select").chosen({'disable_search_threshold': 10});