For example, to set 3 as date $(document). But there are few interesting things which you can also do with setDate() method which you might not be knowing. The DatePicker is part of Kendo UI for jQuery, a professional grade. It provides options for using custom templates for its Month view, setting minimum and maximum dates, a start view, and a depth for navigation. $('#txtDate').datepicker('setDate', new Date()) Īs mentioned earlier, the setDate() method takes date object as argument so you can also set any specific date as well. Earlier today, I posted about 'How to Set Current Date in jQuery UI Datepicker' using setDate() method provided by jQuery UI Datepicker library. The DatePicker enables the user to select a date from a calendar or through a direct input. Example: (edited from ) But with dateFormat : 'yy-mm-dd' it shows the date specified in setDate. So, jQuery code to set current date may look like something similar, $(document).ready(function() ) When I use setDate with dateFormat : 'yy-mm', jQuery UI DatePicker shows today's date and not the date specified in setDate. If you want to set it to current date then you can pass 'today' as argument. Examples to Implement of jQuery Datepicker Below are the examples of jQuery Datepicker: Example 1 The following example illustrates how the datepicker functionality works without passing any parameter to the datepicker () method. Pass date object which needs to be set as an argument to setDate() method. To set current date in control to which jQuery UI datepicker bind, use setDate() method.
0 Comments
Leave a Reply. |