javascript - 如何更改select2中输入文本的宽度,并且标签应内联显示?

标签 javascript jquery html css

当我使用此代码时,文本输入未显示,并且当我们单击该位置时它很小。我希望输入文本具有正常的智慧,并且输入的标签应该是内联的
html

    <!-- Select2 js-->
    <script type="text/javascript" 
    src="http://propeller.in/components/select2/js/select2.full.js">
  </script>
   <!-- Propeller Select2 -->
   <script type="text/javascript" 
   src="http://propeller.in/components/select2/js/pmd-select2.js"></script
    <div class="form-group pmd-textfield pmd-textfield-floating-label">
        <label>Keywords/Tags (Type 5 to 20 items)  </label>
        <select class="select-add-tags form-control pmd-select2-tags" multiple>
        <option>Dallas Cowboys</option>
          <option>New York Giants</option>
          <option>Philadelphia Eagles</option>
          <option>Washington Redskins</option>
          <option>Chicago Bears</option>
          <option>Detroit Lions</option>
          <option>Green Bay Packers</option>
          <option>Minnesota Vikings</option>
          </select>
          </div>


的CSS

/* Select2 css */
@import "http://propeller.in/components/select2/css/select2.min.css";
@import "http://propeller.in/components/select2/css/select2-bootstrap.css";

/* Propeller typography */
@import "http://propeller.in/components/typography/css/typography.css";

/* Propeller text fields */
@import "http://propeller.in/components/textfield/css/textfield.css";

/* Propeller select2 */
@import "http://propeller.in/components/select2/css/pmd-select2.css";
/*---header css--*/


js

<!-- Propeller Select2 -->

    $(document).ready(function() {
        <!-- Select & Add Multiple Tags -->
        $(".select-add-tags").select2({
            tags: true,
            theme: "bootstrap",
        })
    });

最佳答案

您可以通过将类添加到您的选择并使用CSS设置样式来实现
请检查这个答案
https://stackoverflow.com/a/16519861/7621536

关于javascript - 如何更改select2中输入文本的宽度,并且标签应内联显示?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44435226/

相关文章:

javascript - 样式在 javascript 中的变量中不起作用

html - 每页一个网格容器?

html - 以下场景是否有任何css选择器

javascript - 使用异步处理高原流 block

javascript - 我们需要从网页获取 url(地址栏信息)电子邮件

jQuery动态设置高度、宽度

javascript - 使用 jquery 删除动态创建的 div

javascript - 看似随机的加权值显示在 0-100 范围内

javascript - 使用 javascript 自动提交 asp.net 表单

html - 如何在通过 Ajax 附加 <div> 后加载 apply jQuery 函数?