How do I implement and use eyecon's bootstrap-datepicker?

XT_Nova picture XT_Nova · Apr 10, 2013 · Viewed 47.1k times · Source

I visited Eyecon and downloaded the datepicker. I got three folders. 'css', 'js' and 'less'. I have included the bootstrap-datepicker.js and the latest jquery.js and linked the .css in the head:

<!DOCTYPE>
<html>
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Test</title>
        <link rel="stylesheet" type="text/css" href="../css/datepicker.css">
        <link rel="stylesheet" type="text/css" href="../css/bootstrap.css">
        <link rel="stylesheet" type="text/css" href="../css/bootstrap-responsive.css">


    </head>

    <body>
        <div class="well">
            <!--What should I enter here and where/how do I call the function?-->
        </div>

        <script type="text/javascript" src="../js/jquery.js"></script>
        <script type="text/javascript" src="../js/bootstrap-datepicker.js"></script>
        <script type="text/javascript" src="../js/bootstrap.js"></script>
    </body>
</html>

As one can see, I'm already working with the bootstrap library and have therefore also included that.

My question now is: how do I implement and call the date picker function?

Answer

Miljan Puzović picture Miljan Puzović · Apr 10, 2013

$('element').datepicker(); where element is some class, id etc.

http://jsfiddle.net/6kk3k/1/

HTML

<input type="text" class="datepicker">

jQuery

$('.datepicker').datepicker();