引导日期选择器行为不当

问题描述 投票:0回答:0

我最近开始尝试使用 Bootstrap 做一些前端工作,但发现它很棘手。

有两个问题这里

  1. 日历字形出现在日期输入下方。它是 意味着位于它的末尾并且在同一条“行”中
  2. 选择器应该自动关闭,但事实并非如此

欢迎任何帮助。异常页面的代码:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>Add Job</title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1"/>
        <link href="css/bootstrap.min.css" rel="stylesheet"/>
        <!--
        <script src="/bootstrap.min.js"></script>
        -->
        <script src="/bootstrap.min.js"></script>
        <script src="/jquery-3.7.0.min.js"></script>
        <script src="/bootstrap-datepicker.min.js"></script>
        <!--<link href="css/bootstrap-datepicker3.min.css" rel="stylesheet"/>-->
        <link href="css/datepicker.css" rel="stylesheet"/>
        <link href="css/all.min.css" rel="stylesheet"/>
    </head>
    <body>
        <script type="text/javascript">

            $('#datepicker').datepicker({
                            autoclose: true,
                            format: 'yyyy-mm-dd',
                            todayHighlight: true});
        </script>
        <nav class="navbar navbar-expand-sm bg-dark navbar-dark">
            <div class="container-fluid">
                <a class="navbar-brand" href="/">Jobs</a>
                <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#collapsibleNavbar">
                    <span class="navbar-toggler-icon"></span>
                </button>
                <div class="collapse navbar-collapse" id="collapsibleNavbar">
                    <ul class="navbar-nav">
                        <li class="nav-item">
                            <a class="nav-link" href="#">Link1</a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" href="#">Link2</a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" href="/newjobform">Add Job</a>
                        </li>  
                        <li class="nav-item dropdown">
                            <a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown">View</a>
                            <ul class="dropdown-menu">
                                <li><a class="dropdown-item" href="/jobslastten">Last jobs</a></li>
                                <li><a class="dropdown-item" href="/jobs">All jobs</a></li>
                                <li><a class="dropdown-item" href="/jobsnext">Next jobs</a></li>
                            </ul>
                        </li>
                    </ul>
                </div>
            </div>
        </nav>
        <div class="container">
            <div class="page-header" id="banner">
                <div class="row">
                    <div class="col-lg-8 col-md-7 col-sm-6">
                        <div class="row">
                            <div class="col-lg-6 col-md-7 col-sm-6">
                                <h1>Add a Job</h1>
                                <form action="/addjob" method="post"
                                                             enctype="multipart/form-data" class=
                                                                                           "form-horizontal">
                                    <fieldset>
                                        <div class="form-group" data-provide="datepicker">
                                            <label class="col-lg-3 control-label">
                                            Date</label>
                                            <input type="text" placeholder="YYYY-MM-DD" class="form-control">
                                            <span class="input-group-append input-group-addon"><span class="input-group-text"><i class="fa fa-calendar"></i></span></span>
                                            <!--
                                            <div class="input-group-addon">
                                                <span class="glyphicon glyphicon-th"></span>
                                            </div>
                                            -->
                                        </div>

                                        <div class="form-group">
                                            <label class="col-lg-3 control-label">Place
                                            </label>
                                            <div class="col-lg-9">
                                                <input type="text" class="form-control" name=
                                                                          "place" />
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class=
                                            "col-lg-3 control-label">Amount</label>
                                            <div class="col-lg-9">
                                                <input type="text" class="form-control" name=
                                                                          "amount" />
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <div class="col-lg-12 col-lg-offset-3">
                                                <button type="submit" class="btn btn-primary"
                                                                      name="button">Create</button>
                                            </div>
                                        </div>
                                    </fieldset>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </body>
</html>
jquery css bootstrap-4 responsive-design
© www.soinside.com 2019 - 2024. All rights reserved.