Laravel Blade and Javascript

Posted 2 months ago by evripidesk

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('[email protected]')}}">

        <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

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.