物化 CSS 选择语句未显示 [英] Materialize CSS select statement not showing

查看:31
本文介绍了物化 CSS 选择语句未显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

虽然这个问题已经在这个帖子里问过了:

物化 CSS - 选择似乎没有渲染

我在放置此代码的位置时遇到问题:

$(document).ready(function() {$('select').material_select();});

目前,我能想到的最合乎逻辑的事情是这样放置:

<!--在materialize.js之前导入jQuery--><script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script><script type="text/javascript" src="js/materialize.min.js">$(document).ready(function() {$('select').material_select();});<div class="input-field col s12"><选择><option value="" disabled selected>选择您的选项</option><option value="1">选项1</option><option value="2">选项2</option><option value="3">选项3</option></选择><label>Materialize Select</label>

我已尝试将文档"更改为我的文档名称,在本例中为索引",但仍然无效.

我是不是太慢了?

提前致谢.

解决方案

试试这个:

<div class="input-field col s12"><选择><option value="" disabled selected>选择您的选项</option><option value="1">选项1</option><option value="2">选项2</option><option value="3">选项3</option></选择><label>Materialize Select</label>

<!--在materialize.js之前导入jQuery--><script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script><script type="text/javascript" src="js/materialize.min.js"></script><脚本>$(document).ready(function() {$('select').material_select();});

Although this question has already been asked in this thread:

Materialize CSS - Select Doesn't Seem to Render

I'm having problems with where to place this code:

$(document).ready(function() {
    $('select').material_select();
});

At the moment, the most logical thing I can think of is to place it like so:

<body>
  <!--Import jQuery before materialize.js-->
  <script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
  <script type="text/javascript" src="js/materialize.min.js">
    $(document).ready(function() {
        $('select').material_select();
    });
  </script>

  <div class="input-field col s12">
    <select>
      <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>
</body>

I've tried changing the "document" to the name of my document, in this case "index", but it still doesn't work.

Am I just being slow?

Thanks in advance.

解决方案

Try this:

<body>
  <div class="input-field col s12">
    <select>
      <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>
  <!--Import jQuery before materialize.js-->
  <script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
  <script type="text/javascript" src="js/materialize.min.js"></script>
  <script>
     $(document).ready(function() {
        $('select').material_select();
    });
  </script>

</body>

这篇关于物化 CSS 选择语句未显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
前端开发最新文章
热门教程
热门工具
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆