2016-12-02 177 views
-1

如何创建jQuery UI的日期选择器当前的月份和日期和年份只显示如何创建jQuery UI的日期选择器当前的月份和日期和年份只显示

<html> 
<head> 
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css"> 
<link rel="stylesheet" href="/resources/demos/style.css"> 
<script src="https://code.jquery.com/jquery-1.12.4.js"></script> 
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script> 
<script> 
$(function() 
{ 
    $("#datepicker").datepicker({ 
    changeMonth: false, 
     changeYear: false, 
    }); 
}); 
</script> 
</head> 
<body> 
<div class="row"> 
    <label for="email">Check Date:</label><br /> 
     <input id="datepicker" class="input" name="date" type="text" value="" required/><br /> 
    </div> 
</body> 
</html> 

告诉我如何禁用一切,只启用电流日期时间和年份

+0

你是什么意思“当前月份和日期和年份只显示”? – Dekel

+0

为什么然后能够选择,如果您禁用更改日期和年份的能力,并且在您的示例中,您也禁用了月份。 – Steve

+0

我的意思是我在窗体中显示,但我想用户不能更改日期或月或年只在日历当前日期显示和其他禁用只是检查此代码,你会明白,我想说什么 –

回答

0

试试这个:

$("#datepicker").datepicker("option", "disabled", true); 

,但我的建议,如果你不想让用户更改密码,然后代替日期选择的只是股利和显示当前日期。

+0

它不工作sir –

+0

你真的需要日期选择器这个要求吗?你可以在没有日期选择器的情况下做到这一点。 – hhafeez

+0

是的,我会的。但我只问:) –

相关问题