无法为数据输入运行JavaScript

时间:2016-10-22 18:30:14

标签: jquery html css twitter-bootstrap-3

我正在从头开始编写注册页面,并在bootstrap中进行验证。我正在寻找日期下拉月份下降和年度下降。我遇到了Combodate.js。它将输入文本框转换为日期字段。

现在困难在于我无法通过其提到的程序运行。

<html>
<head>
    <title>Form Validation</title>
<!-- Latest compiled and minified CSS -->
    <script src="static/jquery-3.1.1.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
    <script src="C:/Users/DA_YALS/Desktop/fv/static/combodate.js" type="text/javascript"></script>
    <script>
    $(document).ready(function(){
        $('#date').combodate();
    });
    </script>
</head>
<body>
<div class="container-fluid">
    <div class="row">
        <div class="col-lg-3"></div>
        <div class="col-lg-6" style="height: 500px; border:solid black;">
                    <form role="form" id="register-form" autocomplete="off">
                        <div class="form-group">
                            <label for="firstname">First Name:</label>
                            <input class="form-control" id="firstname" placeholder="First Name" type="text">
                        </div>

                        <div class="form-group">
                            <label for="lastname">Last Name:</label>
                            <input class="form-control" id="lastname" placeholder="Last Name" type="text">
                        </div>

                        <div class="form-group">
                            <label for="username">Username:</label>
                            <input class="form-control" placeholder="Uername" type="text" id="username">
                        </div>

                        <div class="form-group">
                            <label for="password">Password:</label>
                            <input class="form-control" placeholder="Password" type="password" id="password">
                        </div>

                        <div class="form-group">
                            <label for="cpassword">Password:</label>
                            <input class="form-control" placeholder="Password" type="password" id="cpassword">
                        </div>

                        <input type="text" id="date" data-format="DD-MM-YYYY" data-template="D MMM YYYY" name="date" value="09-01-2013">
                    </form>
        </div>
        <div class="col-lg-3">
        </div>
    </div>
</div>

</body>
</html>

https://vitalets.github.io/combodate/

1 个答案:

答案 0 :(得分:0)

我想你忘了包括。 请在combodate.js

之前加入

Combodate.js使用Moment.js

此处有更多详情:http://momentjs.com/