MaterializeCSS选择框是否以编程方式打开?

时间:2018-05-23 11:45:27

标签: javascript jquery materialize

我们如何让MaterializeCSS选择框以编程方式打开?

1 个答案:

答案 0 :(得分:0)

/ *请尝试此解决方案,这将有效* /

<div class="input-field col s12">
    <select id="mycustomselect">
      <option value="" disabled selected>Choose your option</option>
      <option value="1">Option 1</option>
      <option value="2">Option 2</option>
      <option value="3">Option 3</option>
    </select>
    <label>Materialize Select</label>
</div>

<script>
    $(document).ready(function(){
        $("#mycustomselect").click();
    });
</script>