实现-下拉菜单不起作用 [英] Materialize - dropdown doesn't work

查看:200
本文介绍了实现-下拉菜单不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将物化框架用于ui设计.如果您查看我的代码,则不会显示该下拉菜单.请帮忙.

I am using materialize framework for ui design. If you look at my code , the dropdown doesn't show. Please help.

<div class="input-field col s3">
    <select>
        <option value="" disabled selected>Choose your option</option>
        <option value="1">USD</option>
        <option value="2">CAD</option>
        <option value="3">HDK</option>
    </select>
    <label>Select Currency</label>
</div>

推荐答案

您必须在JavaScript中初始化select.在关闭body标记之前放置以下代码,它应该可以正常工作.

You must initialize the select in your JavaScript. Put the following code just before closing your bodytag and it should work fine.

<script>
    $(document).ready(function() {
      $('select').material_select();
    });
</script>

这篇关于实现-下拉菜单不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆