1

我试图让我的 Multi-Select 看起来像我在这里找到的示例之一:https ://silviomoreto.github.io/bootstrap-select/examples/ 。我已经从这里下载了 SelectPicker.js:http: //silviomoreto.github.io/bootstrap-select/。它并排显示 2 个盒子,我无法让看起来通用的盒子消失。

<html>
    <head>
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
    </head>
    <body class="container">
        <br/><br/><br/><br/><br/>
        <div class="container-fluid">
            <div class="form-group">
              <select class="selectpicker" id="rating" multiple data-selected-text-format="count > 3">
                <option>G</option>
                <option>PG</option>
                <option>PG-13</option>
                <option>R</option>
                <option>NC-17</option>
              </select>
            </div>
        </div>
        <hr/>
        <button onclick=doThis();>SUBMIT</button>    
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
        <script src="../Documents/Movies_New/movies_ui/bootstrap/js/bootstrap-select.js"></script>
        <script type="text/javascript">
        $(document).ready(function() {
            $('.selectpicker').selectpicker();

            function doThis(){
                alert('Submit');
            }
        });
        </script>
    </body>
</html>

选择选取器 HTML 示例 选择选取器 HTML 示例 2

4

2 回答 2

1

我认为您缺少链接bootstrap-select.css。我在你的例子中使用它..

<html>
    <head>
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">

<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.12.4/css/bootstrap-select.min.css">

<!-- Latest compiled and minified JavaScript -->
    </head>
    <body class="container">
        <br/><br/><br/><br/><br/>
        <div class="container-fluid">
            <div class="form-group">
              <select class="selectpicker" id="rating" multiple data-selected-text-format="count > 3">
                <option>G</option>
                <option>PG</option>
                <option>PG-13</option>
                <option>R</option>
                <option>NC-17</option>
              </select>
            </div>
        </div>
        <hr/>
        <button onclick=doThis();>SUBMIT</button>    
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.12.4/js/bootstrap-select.min.js"></script>

        <script type="text/javascript">
        $(document).ready(function() {
            $('.selectpicker').selectpicker();

            function doThis(){
                alert('Submit');
            }
        });
        </script>
    </body>
</html>
于 2017-07-25T05:13:30.290 回答
0

我想你想念'bootsrap-select'的css。

试试这个。

<html>
<head>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
    <!-- Latest compiled and minified CSS -->
            <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.12.4/css/bootstrap-select.min.css">

</head>
<body class="container">
    <br/><br/><br/><br/><br/>
    <div class="container-fluid">
        <div class="form-group">
          <select class="selectpicker" id="rating" multiple data-selected-text-format="count > 3">
            <option>G</option>
            <option>PG</option>
            <option>PG-13</option>
            <option>R</option>
            <option>NC-17</option>
          </select>
        </div>
    </div>
    <hr/>
    <button onclick=doThis();>SUBMIT</button>    
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <!-- Latest compiled and minified JavaScript -->
            <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.12.4/js/bootstrap-select.min.js"></script>
    <script type="text/javascript">
    $(document).ready(function() {
        $('.selectpicker').selectpicker();

        function doThis(){
            alert('Submit');
        }
    });
    </script>
</body>

于 2017-07-25T05:11:51.610 回答