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条)

报告相同问题?

悬赏问题

  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用
  • ¥15 C++ yoloV5改写遇到的问题
  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
  • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
  • ¥15 帮我写一个c++工程
  • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
  • ¥15 关于smbclient 库的使用