本文介绍了无法使用jquery datetime picket在文本框中呈现当前日期。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

I have input text box for date. I am using JQuery Date picker. 
I want to set and render the current date in my text box when page loads as default.

I could not able to do it. This is my code.  Its not working. 

Please look at and help me out.

What I have tried:

<pre><label for="dateSelection">Date:</label>
<span style="background-color: antiquewhite; padding-top: 3.6px; padding-bottom: 3.6px;">
<input type="text" id="dtID" name="dateSelection" placeholder="mm/dd/yyyy" ng-model="txtDate" required />
<span class="glyphicon glyphicon-calendar" style="padding-right: 3.6px;"></span>
</span>

   
    $(document).ready(function () {
        $('#dtID').datepicker({
            changeMonth: true,
            changeYear: true,
            showAnim: 'slideDown',
            duration: 'fast',
            dateFormat: 'mm/dd/yy',
            onSelect: function (date) {
                $scope.txtDate = date;
                $scope.$apply();
            }
        }).setDate(new Date());
    });

推荐答案




这篇关于无法使用jquery datetime picket在文本框中呈现当前日期。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-20 02:50