jQuery UI Datepicker 超出范围

标签 jquery html css

我的日期选择器正在改变形状并延伸到屏幕的最末端。有什么问题吗?这是我的代码:

此外,我如何更改 jQuery 中的日期,使其显示为 dd-mm-yyyy?

enter image description here

HTML:

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <meta http-equiv="X-UA-Compatible" content="chrome=1,IE=edge" />
        <title>Beauty Factory Bookings</title>
        <link href='http://fonts.googleapis.com/css?family=Montserrat:400,700' rel='stylesheet' type='text/css'>
        <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
        <script src="//code.jquery.com/jquery-1.10.2.js"></script>
        <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js">    </script>
    <script>
    $(function() {
        $( "#datepicker" ).datepicker();
    });
    </script>
    </head>

<body>
    <div class="heading1">
        <p>Select Your Treatment</p>
    <div class="dropdown">
        <select><?php echo $options; ?></select>
    <div class="heading2">
        <p>Select Your Date</p>
        <input type="text" id="datepicker">
    <div class="heading3">
        <p>Select Your Time</p>
</body>

CSS:

    .heading1 {
        text-align: center;
        margin-top: 5%;
        text-transform: uppercase;
        font-size: 16px;
    }

    .heading2 {
        text-align: center;
        margin-top: 3%;
        text-transform: uppercase;
        font-size: 16px;
    }

    .heading3 {
        text-align: center;
        margin-top: 3%;
        text-transform: uppercase;
        font-size: 16px;
    }

    .dropdown select {
        margin-top: 1%;
        display: block;
        height: 30px;
        width: 320px;
        background: #ff656c;
        border: 1px solid #e15960;
        color: #fff;
        font-size: 15px;
        font-family: Montserrat;
        outline: none;
        cursor: pointer;
        text-align: center;
        margin-left: auto;
        margin-right: auto;
        border-radius: 5px;
    }

    img {
        padding-top: 12px;
        padding-left: 12px;
    }

    .headertext {
        float: right;
        padding-top: 20px;
        padding-right: 3%;
    }

    body {
        background: url('http://i.imgur.com/4mKmYMb.jpg') no-repeat fixed center center;
        background-size: cover;
        font-family: Montserrat;
        margin: 0;
        padding: 0;
    }

最佳答案

也许你必须关闭你的 html div

<div class="heading1">
    <p>Select Your Treatment</p>
</div>
<div class="dropdown">
    <select><?php echo $options; ?></select>
</div>
<div class="heading2">
    <p>Select Your Date</p>
    <input type="text" id="datepicker">
</div>
<div class="heading3">
    <p>Select Your Time</p>
</div>

要更改日期格式,请将 dateFormat 选项添加到您的日期选择器函数

$( "#datepicker" ).datepicker({dateFormat: 'dd-mm-yy'});

关于jQuery UI Datepicker 超出范围,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34982812/

相关文章:

html - 使用 CSS 滚动具有视差效果

css - 在 NVD3 svg 上使用 batik 时出现内联 block 错误

html - 使用下拉动画创建纯 css 子菜单时出现问题

jQuery load() 在 div 中显示 css 预加载器

jquery - 如何使用 jQuery 将表中的值添加到一起?

javascript - 检查滚动条是否到达了带有jquery的div

css - IE 忽略 CSS,即使它具有更高的特异性

javascript - 停止一个 div 的背景颜色覆盖另一个 div 的内容,旋转并因此重叠,div

javascript - DIV 和 nowrap 容器顶部的滚动条

javascript - 阻止输入提交html代码/脚本