jQuery 如何实现和使用 eyecon 的 bootstrap-datepicker?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15935718/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 16:04:05  来源:igfitidea点击:

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

javascriptjqueryhtmltwitter-bootstrapbootstrap-datepicker

提问by XT_Nova

I visited Eyeconand 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:

我访问了Eyecon并下载了日期选择器。我得到了三个文件夹。'css'、'js' 和 'less'。我已经包含了 bootstrap-datepicker.js 和最新的 jquery.js 并在头部链接了 .css:

<!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.

如您所见,我已经在使用 bootstrap 库,因此也包含了它。

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

我现在的问题是:如何实现和调用日期选择器功能?

回答by Miljan Puzovi?

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

$('element').datepicker();element某个班级、id 等在哪里?

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

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

HTML

HTML

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

jQuery

jQuery

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