gmaestro
gmaestro

Reputation: 339

Bootstrap calendar call

I need to create input fields but to be date picker so I write this:

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
 <script type='text/javascript' src='http://code.jquery.com/jquery-2.1.0.min.js'></script>

        <script type='text/javascript' src='//netdna.bootstrapcdn.com/bootstrap/3.0.3/js/bootstrap.min.js'></script>
    <link rel="stylesheet" type="text/css" href="//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css">
            <script type='text/javascript' src='datepicker/js/bootstrap-datepicker.js'></script>
                <link rel="stylesheet" type="text/css" href="datepicker/css/datepicker.css">
</head>

<body>
<div class="input-append date" id="dp3" data-date="12-02-2012" data-date-format="dd-mm-yyyy">
  <input class="span2" size="16" type="text" value="12-02-2012">
  <span class="add-on"><i class="icon-th"></i></span>
</div>
</body>
</html>

as you can see here: http://agroagro.com/test.html

there is no datepicker, just simple input fields, also there is no bootstrap style

What is the problem?

Upvotes: 0

Views: 819

Answers (2)

Girish
Girish

Reputation: 12127

Please call bootstreap datepicker function like

    <script type="text/javascript">
      $(function() {
        $(".span2").datepicker({
            dateFormat: "YYYY-mm-dd",
            changeMonth: true,
            changeYear: true,
        });
     });
    </script> 

Fiddle

Upvotes: 1

HTTP
HTTP

Reputation: 1724

Why not use the default html5 date attribute and use the form-control class of bootstrap like

<input type = "date" name = "mydate" class = "form-control">

See fiddle

Upvotes: 1

Related Questions