douyue4334 2017-11-04 10:34
浏览 125
已采纳

Laravel颜色选择器无法正常工作

I want to use color picker in my form and i have tried below code in my project but its not working. Anything wrong with the code?,

In view blade,

  @extends('layouts.blank')

@push('stylesheets')
<link   href="https://maxcdn.bootstrapcdn.com/bootstrap
/3.3.6/css/bootstrap.min.css" rel="stylesheet">
 <link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-
colorpicker/2.5.1/css/bootstrap-colorpicker.min.css" rel="stylesheet">

 @endpush

 @section('main_container')
<div class="main-content">

<!-- page content -->
  <div id="page-wrapper">
    <div class="tab-pane active" id="horizontal-form">

   <h3 class="blank1">Vehicle Details</h3>

            {!! Form::open(array('class' => 'form-horizontal','route' => 
          'vehicles.store','method'=>'POST')) !!}
 <script type="text/javascript">
  $('.colorpicker').colorpicker();

 </script>
 <div class="row">
 <div id="cp2" class="input-group colorpicker colorpicker-component"> 

   <input type="text" value="#00AABB" class="form-control" /> 

  <span class="input-group-addon"><i></i></span> 

 </div>
  <div class="row">
   <div class="form-group">
  <div class="col-md-6">
   <div class="col-xs-12 col-sm-12 col-md-12 text-center">
            <button type="submit" class="btn btn-primary">Submit</button>
    </div>
    </div>
    </div>
    </div>

  {{ Form::close() }}

 </div>
 </div>
    </div>
    </div>
    @endsection
    @pushonce('custom-scripts')

    <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-
colorpicker/2.5.1/js/bootstrap-colorpicker.min.js"></script>

  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.js">
 </script>
  @endpushonce

I got an empty text box not showing the color.Is there any problem with including css or js files. How can I solve this ?Can anyone help?

  • 写回答

3条回答 默认 最新

  • dpu66046 2017-11-11 07:49
    关注

    I have used the scripts through @yield scripts then it worked.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥25 关于##爬虫##的问题,如何解决?:
  • ¥15 ZABBIX6.0L连接数据库报错,如何解决?(操作系统-centos)
  • ¥15 找一位技术过硬的游戏pj程序员
  • ¥15 matlab生成电测深三层曲线模型代码
  • ¥50 随机森林与房贷信用风险模型
  • ¥50 buildozer打包kivy app失败
  • ¥30 在vs2022里运行python代码
  • ¥15 不同尺寸货物如何寻找合适的包装箱型谱
  • ¥15 求解 yolo算法问题
  • ¥15 虚拟机打包apk出现错误