如何在Bootstrap Datepicker中更改年份 [英] How Do I Change Year In Bootstrap Datepicker

查看:98
本文介绍了如何在Bootstrap Datepicker中更改年份的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用引导日期选择器,但它不能正常工作,因为当我在特定范围内选择特定年份然后直接显示在文本框中的日期月份选择不会出现

例如如果我想选择1989年10月31日,然后我将选择1989年从1980年至1989年的

选择1989年它不允许我选择一个月它直接在文本框中显示日期,如1989-09-01



这是我选择日期的脚本



 <   script    类型  =  text / javascript >  
$(document).ready(function(){
var dp = $('#< % = txt_birthdate.ClientID % > ');
dp.datepicker({
changeMonth:true,
changeYear:true,
格式:yyyy-mm-dd,
语言:tr
})。on('changeDate',function(ev){
$(this).blur();
$(this).datepicker('hide');
} );
});
< / script >





这是我的文本框代码



< pre lang =xml> < div class = form-group col-md- 4 id = 生日 >
< 标签 >
出生日期:
< / label >
< asp:TextBox ID = txt_birthdate runat = server CssClass =' form-control' ClientIDMode = 静态

< span class =code-attribute> < span class =code-attribute> 占位符 = 出生日期 > < / asp:TextBox >
< / div >







请帮我解决这个问题

解决方案

(document).ready(function(){
var dp =


('#<% = txt_birthdate.ClientID %> ');
dp.datepicker({
changeMonth:true,
changeYear:true,
格式:yyyy-mm-dd,
语言:tr
})。on('changeDate',function(ev){


(this).blur();


I am using bootstrap date picker but its not working fine because when i select a particular year among a specific range then directly date in displayed in a text box month selecting is not appear
For Example If i want to select 31 Oct 1989 then i will select the year 1989 from
1980-1989 after selecting 1989 it doesn't allow me to select a month it directly display a date in a text box such as 1989-09-01

Here is my script for selecting date

<script type="text/javascript">
        $(document).ready(function () {
            var dp = $('#<%=txt_birthdate.ClientID%>');
            dp.datepicker({
                changeMonth: true,
                changeYear: true,
                format: "yyyy-mm-dd",
                language: "tr"
            }).on('changeDate', function (ev) {
                $(this).blur();
                $(this).datepicker('hide');
            });
        });
    </script>



Here is my code for a Text Box

<div class="form-group col-md-4" id="birthdate">
                                <label>
                                    Date Of Birth :
                                </label>
                                <asp:TextBox ID="txt_birthdate" runat="server" CssClass='form-control' ClientIDMode="Static"

                                    placeholder="Date Of Birth"></asp:TextBox>
                            </div>




Please help me to solve this problem

解决方案

(document).ready(function () { var dp =


('#<%=txt_birthdate.ClientID%>'); dp.datepicker({ changeMonth: true, changeYear: true, format: "yyyy-mm-dd", language: "tr" }).on('changeDate', function (ev) {


(this).blur();


这篇关于如何在Bootstrap Datepicker中更改年份的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆