Skip to content
Advertisement

function jquery datetimepicker is not found/work

<link href="css/bootstrap-datetimepicker.min.css" rel="stylesheet" />
<script src="Js/bootstrap-datetimepicker.min.js"></script>
<script src="Js/bootstrap-datetimepicker.he.js"></script>
<script src="https://code.jquery.com/jquery-3.4.0.min.js" integrity="sha256-BJeo0qm959uMBGb65z40ejJYGSgR7REI4+CW1fNKwOg=" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script>

why this is not working:

$('.datepicker').datetimepicker({
       format: 'DD/MM/YYYY'
    });

datetimepicker is not a function jquery

What is the right arrangement that will work?

Advertisement

Answer

You can get the bootstrap datetimepicker from here.

$(function () {
 $('#dtpickerdemo').datetimepicker();
});
<!DOCTYPE html>
<html>
  <head>
    <link
      rel="stylesheet"
      href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css"
    />
    <link
      href="//cdn.rawgit.com/Eonasdan/bootstrap-datetimepicker/e8bddc60e73c1ec2475f827be36e1957af72e2ea/build/css/bootstrap-datetimepicker.css"
      rel="stylesheet"
    />
    <script
      type="text/javascript"
      src="//code.jquery.com/jquery-2.1.1.min.js"
    ></script>
    <script
      type="text/javascript"
      src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"
    ></script>
    <script src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.9.0/moment-with-locales.js"></script>
    <script src="//cdn.rawgit.com/Eonasdan/bootstrap-datetimepicker/e8bddc60e73c1ec2475f827be36e1957af72e2ea/src/js/bootstrap-datetimepicker.js"></script>
  </head>
  <body>
    <div class="container">
      <div class="row">
        <div class="col-lg-9">
          <div class="form-group">
            <label for="dtpickerdemo" class="col-sm-2 control-label"
              >Select date/time:</label
            >
            <div class="col-sm-4 input-group date">
              <input type="text" class="form-control" id="dtpickerdemo" />
            </div>
          </div>
        </div>
      </div>
    </div>
  </body>
</html>
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement