jquery-ui-datepicker

Disable future dates in jQuery UI Datepicker

徘徊边缘 提交于 2019-11-27 04:02:35
问题 Is it possible to disable future date from today? Let say today is 23/10/2010, so 24/10/2010 onwards are disabled. Sorry I am very new in jQuery and JavaScript. 回答1: Yes, indeed. The datepicker has the maxdate property that you can set when you initialize it. Here's the codez $("#datepicker").datepicker({ maxDate: new Date, minDate: new Date(2007, 6, 12) }); 回答2: $(function() { $("#datepicker").datepicker({ maxDate: '0'}); }); 回答3: Try This: $('#datepicker').datepicker({ endDate: new Date() }

jQuery-UI datepicker default date

丶灬走出姿态 提交于 2019-11-27 03:48:46
I have a problem with the jQuery-UI datepicker, I have searched and searched but I didn't find the answer. I have the following code: <script type="text/javascript"> $(function() { $("#birthdate" ).datepicker({ changeMonth: true, changeYear: true, yearRange: '1920:2010', dateFormat : 'dd-mm-yy', defaultDate: '01-01-1985' }); }); </script> I want that when the user click in the #birthdate input that the current date selected to be 01-01-1985 , now it's setting the current date. Codesleuth Try passing in a Date object instead. I can't see why it doesn't work in the format you have entered:

jQuery Datepicker: Prevent closing picker when clicking a date

不羁岁月 提交于 2019-11-27 01:58:29
Hi fellow stackoverflow:ers, I'm using the jQuery Datepicker plugin , together with Martin Milesich Timepicker plugin. Everything works great, except for the fact that clicking a date in the datepicker, closes the widget, leaving no time to pick the time. Question: So I'm wondering if there's a way to prevent the widget from closing when clicking a date, and instead force users to click the "Done" button (that shows up when enabling the "showButtonPanel: true" option), or clicking outside of the widget. I don't want my users having to open the widget twice! See the behavior online at the

jQuery event handler .on() not working

限于喜欢 提交于 2019-11-27 01:46:12
问题 I want to attach a event to dynamically created element class.So i used live function but it was not triggered. So checked live function reference ,there i red below notes As of jQuery 1.7, the .live() method is deprecated. Use .on() to attach event handlers. Users of older versions of jQuery should use .delegate() in preference to .live(). so decide to use on function,But it still not working.The text field is already attached with jquery ui datpicker.On another element select i disabled

Proper way to add a callback to jQuery DatePicker

被刻印的时光 ゝ 提交于 2019-11-27 01:36:55
问题 DatePicker has an internal function, _adjustDate() , which I'd like to add a callback after. Current Method This is how I'm currently doing this. Basically, just replacing the function defintion with itself, plus the new operations. This effects all datepickers, which I'm not sure is desired, either. $(function(){ var old = $.datepicker._adjustdate; $.datepicker._adjustDate = function(){ old.apply(this, arguments); // custom callback here console.log('callback'); }; }); _adjustDate is what's

Sonata Admin Bundle: DatePicker range

本小妞迷上赌 提交于 2019-11-27 01:33:21
问题 How would I create a doctrine_orm_datetime_range filter in the Sonata Admin Bundle which uses the jQuery UI datepicker? I tried the following, but it doesn't work: protected function configureDatagridFilters(DatagridMapper $datagridMapper) { $datagridMapper ->add('datumUitgevoerd', 'doctrine_orm_datetime', array('widget' => 'single_text'), null, array('required' => false, 'attr' => array('class' => 'datepicker'))) ; } 回答1: UPDATED 2016-02-02 If you are using 3.* Symfony the following twig

jQuery Datepicker localization

泄露秘密 提交于 2019-11-27 00:05:39
问题 I need a french calendar and I can't understand the problem. I guess I'm not using the regional options like it should be. But... Here is my code : $(function() { $('#Date').datepicker({ showMonthAfterYear: false, showOn: 'both', buttonImage: 'media/img/calendar.png', buttonImageOnly: true, dateFormat:'d MM, y' }, $.datepicker.regional['fr'] ); }); 回答1: You can do like this $.datepicker.regional['fr'] = {clearText: 'Effacer', clearStatus: '', closeText: 'Fermer', closeStatus: 'Fermer sans

jQuery UI: Datepicker set year range dropdown to 100 years

99封情书 提交于 2019-11-26 23:46:12
问题 Using the Datepicker the year drop down by default shows only 10 years. The user has to click the last year in order to get more years added. How can we set the initial range to be 100 years so that the user will see a large list by default? function InitDatePickers() { $(".datepicker").datepicker({ changeMonth: true, changeYear: true, showButtonPanel: true, maxDate: '@maxDate', minDate: '@minDate' }); } 回答1: You can set the year range using this option per documentation here http://api

.datepicker('setdate') issues, in jQuery

浪子不回头ぞ 提交于 2019-11-26 23:12:11
问题 I have a function that executes a query to get some data based on a certain date range which is selected using .datepicker(). I am trying to set the datepicker's that are in the response data back to the date range which was selected before the query was executed. queryDate = '2009-11-01'; $('#datePicker').datepicker('setDate', queryDate); has the interesting result of setting the datepicker to today's date! I wouldn't be so confused if it just spit out an error. Why does it set it to today's

How to change the cell color of a jquery datepicker

给你一囗甜甜゛ 提交于 2019-11-26 21:53:10
问题 I have a jquery datepicker and I need to be able to change the background color for the selected cell date. I'm trying with something like: $("#fecha").datepicker({ onSelect: function(value, date) { alert(date.css()); } }); hoping that the date parameter refers to the selected cell, but it doesn't seem to work. Any suggestion? //Edit: The solution should let me have different cells with different colors set dynamically, this is why I'm trying with onSelect instead of changing the CSS directly