隐藏物化选择框中的选项

实现文档 – http://materializecss.com/forms.html

我想通过jquery隐藏Materialize select选项。 我在一个选项中添加了一个类,并使用此代码$('.break_5').hide(); 选项隐藏成功。 但它显示在Materialise选择框中。

根据文档,为了更新select中的项目,必须销毁材料并重新运行初始化。

 $('#mySelectID').material_select('destroy'); 

然后使用或不使用某些选项重新创建选择并初始化新选择。

 $('#mySelectID option').hasClass('break_5').remove(); $('#mySelectID').material_select();