在jquery multiselect中显示选中的值

时间:2018-01-14 09:04:32

标签: javascript jquery twitter-bootstrap laravel

我正在使用laravel + bootstrap和jquery等创建一个应用程序。现在我想进行jquery multiselect,但我不知道如何显示我在数据库中的值。你能帮我吗?这就是我实际拥有的东西:

<form action="{{ action('Player@store') }}" method="post" class="form-horizontal">
                  {{ csrf_field() }}
              <div class="row">
              <div class="col-xs-5">
                  <select name="from[]" id="multiselect" class="form-control" size="8" multiple="multiple">
                      <option value="1">Item 1</option>
                      <option value="2">Item 5</option>
                      <option value="2">Item 2</option>
                      <option value="2">Item 4</option>
                      <option value="3">Item 3</option>
                  </select>
              </div>
              <div class="col-xs-2">
                  <button type="button" id="multiselect_rightAll" class="btn btn-block">
                    <i class="fa fa-angle-double-right" aria-hidden="true"></i>
                  </button>
                  <button type="button" id="multiselect_rightSelected" class="btn btn-block">
                  <i class="fa fa-angle-right" aria-hidden="true"></i></button>
                  <button type="button" id="multiselect_leftSelected" class="btn btn-block">
                    <i class="fa fa-angle-left" aria-hidden="true"></i>
                  </button>
                  <button type="button" id="multiselect_leftAll" class="btn btn-block">
                    <i class="fa fa-angle-double-left" aria-hidden="true"></i>
                  </button>
              </div>

              <div class="col-xs-5">
                  <select name="to[]" id="multiselect_to" class="form-control" size="8" multiple="multiple"></select>
              </div>
          </div>

          <script type="text/javascript">
          jQuery(document).ready(function($) {
              $('#multiselect').multiselect();
          });
          </script>
          <button type="submit" class="btn btn-success">@lang('main.save')</button>
        </form>

0 个答案:

没有答案