You are extending a template so you can only use the sections that template offers you. Remove the stuff before @section and after @endsection
Apr 18, 2019
7
Level 1
Laravel Blade and Javascript
Hello I have the below blade with datepicker but is not working the datepicker (no error in concole)
@extends('layouts.app')
<head>
<title></title>
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.5.0/css/bootstrap-datepicker.css" rel="stylesheet">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.5.0/js/bootstrap-datepicker.js"></script>
<meta name="csrf-token" content="{{ csrf_token() }}">
</head>
@section('content')
<body>
<div class="container">
@if ($errors->any())
<div class="alert alert-danger">
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div><br />
@endif
<form method="post" action="{{action('EmployeesController@createJobTitle')}}">
<input name="date" class="date form-control" type="text">
</form>
</div>
@endsection
</body>
<script type="text/javascript">
$('.date').datepicker({
format: 'mm-dd-yyyy'
});
</script>
if I dont use the endsection then is working but is breaking the template
Level 122
only the code inside section will be in the rendered page
also, have you removed references to app.js in the layout file, since if not then you have jquery loaded twice
Please or to participate in this conversation.