Sunday, May 19, 2024
 Popular · Latest · Hot · Upcoming
163
rated 0 times [  167] [ 4]  / answers: 1 / hits: 24636  / 8 Years ago, mon, september 26, 2016, 12:00:00

I try to use a datepicker, but it doesn't work.



I have this error : $(...).datepicker is not a function



I use many frameworks and librairy (Adminlte, bootstrap, chartjs, datatable). And I think that there is a conflicts between they.





$(document).ready(function() {
$('#datepicker').datepicker();
$('#datepicker').on(changeDate, function() {
$('#my_hidden_input').val(
$('#datepicker').datepicker('getFormattedDate')
);
});
});

<!DOCTYPE html>
<html lang=fr>

<head>
<meta charset=utf-8>
<meta http-equiv=X-UA-Compatible content=IE=edge>
<title>AdminLTE 2 | Dashboard</title>
<!-- Tell the browser to be responsive to screen width -->
<meta content=width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no name=viewport>
<!-- Bootstrap 3.3.6 -->
<link rel=stylesheet href=./css/bootstrap.min.css>
<!-- Font Awesome -->
<link rel=stylesheet href=https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.5.0/css/font-awesome.min.css>
<!-- Ionicons -->
<link rel=stylesheet href=https://cdnjs.cloudflare.com/ajax/libs/ionicons/2.0.1/css/ionicons.min.css>

<!-- Theme style -->
<link rel=stylesheet href=./css/AdminLTE.min.css>
<!-- AdminLTE Skins. Choose a skin from the css/skins
folder instead of downloading all of them to reduce the load. -->
<link rel=stylesheet href=./css/skin-black-light.css>
<!-- CSS Table -->
<link rel=stylesheet href=https://cdn.datatables.net/1.10.12/css/jquery.dataTables.min.css>


<!-- My Style -->
<link rel=stylesheet href=./css/style_general.css>
<link rel=stylesheet href=./css/style.css>

<link rel=stylesheet/less type=text/css href=./less/dropdown.less />
<link rel=stylesheet/less type=text/css href=./less/sprites.less />


<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src=https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js></script>
<script src=https://oss.maxcdn.com/respond/1.4.2/respond.min.js></script>
<![endif]-->
</head>

<body class=hold-transition skin-blue sidebar-mini fixed>

<div class=form-group>
<label>Date</label>
<div class=input-group date margin-bottom-10 id=datetimepicker1>
<input type=text class=form-control id=date name=date placeholder=DD/MM/YYY>
<span class=input-group-addon><i class=glyphicon glyphicon-calendar></i></span>
</div>
</div>

<!-- jQuery 2.2.3 -->
<script src=https://code.jquery.com/jquery-2.2.3.min.js></script>
<!-- Bootstrap 3.3.6 -->
<script src=./js/bootstrap.min.js></script>
<!-- AdminLTE App -->
<script src=./js/app.min.js></script>
<!-- ChartJS 1.0.1 -->
<script src=./js/Chart.min.js></script>
<!-- AdminLTE for demo purposes -->
<script src=./js/demo.js></script>
<!-- SlimScroll 1.3.0 -->
<script src=./js/jquery.slimscroll.min.js></script>
<!-- JS table -->
<script src=https://cdn.datatables.net/1.10.12/js/jquery.dataTables.min.js></script>
<script src=./js/test_table.js></script>
<script src=./js/js.js></script>
</body>

</html>




More From » jquery

 Answers
9

I think datepicker is available in JQuery UI but you didn't include those library files. when I include the below files there is no such error $(...).datepicker



please include these file and check

[link] https://code.jquery.com/ui/1.12.1/jquery-ui.js

[link] https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css


[#60597] Friday, September 23, 2016, 8 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
jimmieo

Total Points: 515
Total Questions: 102
Total Answers: 110

Location: Kazakhstan
Member since Mon, Sep 26, 2022
2 Years ago
;