In this article, we will deal with implement bootstrap datepicker in laravel 5 application. datepicker is nothing related to laravel, it is a separated jquery library. you can simply use datepicker in laravel as you use on another framework or code php project. In this example i use bootstrap-datepicker.js library for datepicker.
Here, you can simply use on your blade file, as like bellow to use:
your.blade.php
<!DOCTYPE html>
<html>
<head>
<title>Laravel Bootstrap Datepicker</title>
<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-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>
</head>
<body>
<div class="container">
<h1>Laravel Bootstrap Datepicker</h1>
<input class="date form-control" type="text">
</div>
<script type="text/javascript">
$('.date').datepicker({
format: 'mm-dd-yyyy'
});
</script>
</body>
</html>
Do you like below Tutorials ?
- How to Open URL in New Tab using Jquery?
- Laravel 7.x and 6.x Routing Tutorial
- Ng Bootstrap Modal in Angular 8 Example
- Bootstrap 4 Datepicker in Angular 9/8 Example
- Disable Registration Route in Laravel
- Bootstrap Timepicker in Angular Example
- Count Number of Pages in PDF - PHP Script
- Digital Signature PHP Script Example