我想在我的代码中添加一个datepicker来选择用户的出生日期,但是,即使我嵌入了jquery和jquery-ui,日期选择器也没有运行并显示出来...... / p>
这是我的代码(我正在使用laravel 5.2)
这是布局:
<!--
Retrospect by TEMPLATED
templated.co @templatedco
Released for free under the Creative Commons Attribution 3.0 license (templated.co/license)-->
<head>
<title>@yield('title')</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!--[if lte IE 8]><script src="assets/js/ie/html5shiv.js"></script><![endif]-->
<link rel="stylesheet" href="{{asset('assets/css/index.css')}}" />
<script src="{{asset('jquery-ui/external/jquery/jquery.js')}}"></script>
<link rel="stylesheet" href="{{asset('jquery-ui/jquery-ui.css')}}">
<!--[if lte IE 8]><link rel="stylesheet" href="assets/css/ie8.css" /><![endif]-->
<!--[if lte IE 9]><link rel="stylesheet" href="assets/css/ie9.css" /><![endif]-->
<!-- Header -->
<header id="header" class="skel-layers-fixed">
<h1><a href="/">@yield('header')</a></h1>
<a href="#nav">Menu</a>
</header>
<!-- Nav -->
<nav id="nav">
<!-- Authentication Links -->
@if (Auth::guard('web')->guest())
<ul class="links">
<li><a href="{{URL::to('/')}}">Home</a></li>
<li><a href="{{URL::to('assessment')}}">assessment</a></li>
<!-- <li><a href="email">Kirim Email</a></li> -->
</ul>
@else
<ul class="links">
<li><a href="{{URL::to('/')}}">Home</a></li>
<li><a href="{{URL::to('assessment')}}">assessment</a></li>
<li><a href="{{URL::to('user/edit')}}">Edit Account</a></li>
<li><a href="{{URL::to('user/pasien')}}">Edit Pasien</a></li>
<li><a href="{{URL::to('logout')}}">Logout</a></li>
<!-- <li><a href="email">Kirim Email</a></li> -->
</ul>
@endif
</nav>
@yield('content')
<!-- Footer -->
<footer id="footer">
<div class="inner">
<ul class="icons">
<li><a href="#" class="icon fa-facebook">
<span class="label">Facebook</span>
</a></li>
<li><a href="#" class="icon fa-twitter">
<span class="label">Twitter</span>
</a></li>
<li><a href="#" class="icon fa-instagram">
<span class="label">Instagram</span>
</a></li>
<li><a href="#" class="icon fa-linkedin">
<span class="label">LinkedIn</span>
</a></li>
</ul>
<p>
<a href="faq">FAQ</a> | <a href="terms">Terms & Conditions</a>
</p>
<ul class="copyright">
<li>© PT. Digital Media Laboratorindo.</li>
<li>Images: <a href="http://unsplash.com">Unsplash</a>.</li>
<li>Design: <a href="http://templated.co">TEMPLATED</a>.</li>
</ul>
</div>
</footer>
<!-- Scripts -->
<script src="{{asset('assets/js/skel.min.js')}}"></script>
<script src="{{asset('assets/js/util.js')}}"></script>
<!--[if lte IE 8]><script src="assets/js/ie/respond.min.js"></script><![endif]-->
<script src="{{asset('assets/js/index.js')}}"></script>
这是我自己的表格......
@extends('master.nonindex')
@section('title')
Halaman Edit Pasien
@endsection
@section('header')
Edit Pasien
@endsection
@section('content')
<script src="{{asset('jquery-ui/jquery-ui.min.js')}}"></script>
<script type="text/javascript">
$(".datepicker1").datepicker({
//home service
dateFormat: 'yy-mm-dd',
altField: '.datepicker1',
altFormat: 'yy-mm-dd',
minDate: '+1d',
maxDate: '+14d'
});
</script>
<!-- Main -->
<section id="main" class="wrapper">
<div class="container">
<!-- Form -->
<section>
@foreach($pasien as $p)
<h3>Edit Pasien {{$p->nama_panggilan}}</h3>
<form method="post" action="{{URL::to('updatePasien')}}">
<input type="hidden" name="nama_panggilan" value="{{$p->nama_panggilan}}">
<div class="row uniform 50%">
<div class="6u 12u$(xsmall)">
Nama depan:
<input type="text" name="nama_depan" id="name" value="{{$p->nama_depan}}" placeholder="Nama Depan" />
</div>
<div class="6u$ 12u$(xsmall)">
Nama belakang:
<input type="text" name="nama_belakang" id="email" value="{{$p->nama_belakang}}" placeholder="Nama Belakang" />
</div>
<div class="12u$">
No. KTP:
<input type="text" name="ktp" value="{{$p->no_ktp}}" placeholder="Nomor KTP Anda">
</div>
<div class="12u$">
Alamat:
<input type="text" name="alamat" value="{{$p->alamat}}" placeholder="Tuliskan Alamat Anda">
</div>
<div class="12u$">
Tanggal lahir:
<input type="text" name="tanggal_lahir" value="{{$p->tanggal_lahir}}" placeholder="Tanggal Lahir" class="datepicker1">
</div>
<div class="12u$">
Agama: <br>
<select name="agama" id="category">
<option value="{{$p -> agama}}">{{$p -> agama}}</option>
<option value="Kristen Protestan">Kristen Protestan</option>
<option value="Kristen Katolik">Kristen Katolik</option>
<option value="Islam">Islam</option>
<option value="Konghucu">Konghucu</option>
<option value="Hindu">Hindu</option>
<option value="Budha">Budha</option>
</select>
</div>
<div class="12u$">
Jenis Kelamin: <br>
@if($p->jenis_kelamin=='L')
<select name="jenis_kelamin" id="category">
<option value="L" selected>Laki-laki</option>
<option value="P">Perempuan</option>
</select>
@elseif($p->jenis_kelamin=='P')
<select name="jenis_kelamin" id="category">
<option value="L">Laki-laki</option>
<option value="P" selected>Perempuan</option>
</select>
@else
<select name="jenis_kelamin" id="category">
<option value="" selected>Jenis Kelamin Anda</option>
<option value="L">Laki-laki</option>
<option value="P" >Perempuan</option>
</select>
@endif
</div>
<div class="6u 12u$(xsmall)">
TB:
<input type="text" name="tb" id="name" value="{{$p->tb}}" placeholder="TB Anda" />
</div>
<div class="6u$ 12u$(xsmall)">
BB:
<input type="text" name="bb" id="email" value="{{$p->bb}}" placeholder="BB Anda" />
</div>
<div class="12u$">
Golongan Darah: <br>
<select name="goldar" id="category">
<option value="{{$p -> gol_darah}}">{{$p -> gol_darah}}</option>
<option value="A">A</option>
<option value="B">B</option>
<option value="AB">AB</option>
<option value="O">O</option>
</select>
</div>
<div class="12u$">
Status Perkawinan: <br>
<select name="status_perkawinan" id="category">
<option value="{{$p -> status_perkawinan}}">{{$p -> status_perkawinan}}</option>
<option value="1">Kawin</option>
<option value="2">Belum Kawin</option>
</select>
</div>
<div class="12u$">
Apakah anda mempunyai Alergi?
<input type="text" name="alergi" value="{{$p->alergi}}" placeholder="Apakah anda mempunyai Alergi">
</div>
<div class="12u$">
<ul class="actions">
<li><input type="submit" value="Update" class="special" /></li>
</ul>
</div>
</div>
</form>
@endforeach
</section>
</div>
</section>
@endsection
感谢您的帮助......
更新:
这是代码人造丝
@extends('master.nonindex')
@section('title')
Halaman Edit Pasien
@endsection
@section('header')
Edit Pasien
@endsection
@section('content')
<script type="text/javascript">
$(document).ready(function(){
$(".datepicker1").datepicker({
//home service
dateFormat: 'yy-mm-dd',
altField: '.datepicker1',
altFormat: 'yy-mm-dd',
minDate: '+1d',
maxDate: '+14d'
});
});
</script>
<!-- Main -->
<section id="main" class="wrapper">
<div class="container">
<!-- Form -->
<section>
@foreach($pasien as $p)
<h3>Edit Pasien {{$p->nama_panggilan}}</h3>
<form method="post" action="{{URL::to('updatePasien')}}">
<input type="hidden" name="nama_panggilan" value="{{$p->nama_panggilan}}">
<div class="row uniform 50%">
<div class="6u 12u$(xsmall)">
Nama depan:
<input type="text" name="nama_depan" id="name" value="{{$p->nama_depan}}" placeholder="Nama Depan" />
</div>
<div class="6u$ 12u$(xsmall)">
Nama belakang:
<input type="text" name="nama_belakang" id="email" value="{{$p->nama_belakang}}" placeholder="Nama Belakang" />
</div>
<div class="12u$">
No. KTP:
<input type="text" name="ktp" value="{{$p->no_ktp}}" placeholder="Nomor KTP Anda">
</div>
<div class="12u$">
Alamat:
<input type="text" name="alamat" value="{{$p->alamat}}" placeholder="Tuliskan Alamat Anda">
</div>
<div class="12u$">
Tanggal lahir:
<input type="text" name="tanggal_lahir" value="{{$p->tanggal_lahir}}" placeholder="Tanggal Lahir" class="datepicker1">
</div>
<div class="12u$">
Agama: <br>
<select name="agama" id="category">
<option value="{{$p -> agama}}">{{$p -> agama}}</option>
<option value="Kristen Protestan">Kristen Protestan</option>
<option value="Kristen Katolik">Kristen Katolik</option>
<option value="Islam">Islam</option>
<option value="Konghucu">Konghucu</option>
<option value="Hindu">Hindu</option>
<option value="Budha">Budha</option>
</select>
</div>
<div class="12u$">
Jenis Kelamin: <br>
@if($p->jenis_kelamin=='L')
<select name="jenis_kelamin" id="category">
<option value="L" selected>Laki-laki</option>
<option value="P">Perempuan</option>
</select>
@elseif($p->jenis_kelamin=='P')
<select name="jenis_kelamin" id="category">
<option value="L">Laki-laki</option>
<option value="P" selected>Perempuan</option>
</select>
@else
<select name="jenis_kelamin" id="category">
<option value="" selected>Jenis Kelamin Anda</option>
<option value="L">Laki-laki</option>
<option value="P" >Perempuan</option>
</select>
@endif
</div>
<div class="6u 12u$(xsmall)">
TB:
<input type="text" name="tb" id="name" value="{{$p->tb}}" placeholder="TB Anda" />
</div>
<div class="6u$ 12u$(xsmall)">
BB:
<input type="text" name="bb" id="email" value="{{$p->bb}}" placeholder="BB Anda" />
</div>
<div class="12u$">
Golongan Darah: <br>
<select name="goldar" id="category">
<option value="{{$p -> gol_darah}}">{{$p -> gol_darah}}</option>
<option value="A">A</option>
<option value="B">B</option>
<option value="AB">AB</option>
<option value="O">O</option>
</select>
</div>
<div class="12u$">
Status Perkawinan: <br>
<select name="status_perkawinan" id="category">
<option value="{{$p -> status_perkawinan}}">{{$p -> status_perkawinan}}</option>
<option value="1">Kawin</option>
<option value="2">Belum Kawin</option>
</select>
</div>
<div class="12u$">
Apakah anda mempunyai Alergi?
<input type="text" name="alergi" value="{{$p->alergi}}" placeholder="Apakah anda mempunyai Alergi">
</div>
<div class="12u$">
<ul class="actions">
<li><input type="submit" value="Update" class="special" /></li>
</ul>
</div>
</div>
</form>
@endforeach
</section>
</div>
</section>
<script src="{{asset('jquery-ui/jquery-ui.min.js')}}"></script>
@endsection
答案 0 :(得分:0)
您可能希望首先在浏览器上检查客户端错误。这样可以清楚地了解&#34;到底出了什么问题?&#34;。