JQuery UI Datepicker and Google Chrome not working

I'm having problems with jQueryUI Datepicker and Google Chrome. My datepicker works as expected with IE8, Firefox and Safari. The problem is clicking the date-related text box in Chrome. This gives me a crash page: "Unfortunately, an error occurred ...". My page has a text box with a dumper. Datepicker is language dependent and dynamically loads the correct language settings. Datpicker should also display drop-down lists of the month and year. The code is as follows

$(function() { $.datepicker.setDefaults($.extend({ changeMonth: true, changeYear: true }, $.datepicker.regional[''])); $('#<%= TextBoxBirthDate.ClientID %>').datepicker($.datepicker.regional[$('#LabelRegionalSettings').val()]);}); 

If I only summarize datepicker with one parameter, i.e. changeYear, it works in Chrome. But if I add another parameter, i.e. changeMonth, Chrome will crash.

Is the code incorrect? If so, how to fix it?

Any help is much appreciated!


I updated the code to make it more readable. But still Chrome falls on me if I add the changeMonth parameter.

 $(function() { $.datepicker.setDefaults($.datepicker.regional['']); $('#<%= TextBoxBirthDate.ClientID %>').datepicker($.datepicker.regional[$('#LabelRegionalSettings').val()]);<br /> $('#<%= TextBoxBirthDate.ClientID %>').datepicker('option', 'changeMonth', true); $('#<%= TextBoxBirthDate.ClientID %>').datepicker('option', 'changeYear', true); $('#<%= TextBoxBirthDate.ClientID %>').datepicker('option', 'yearRange', '-50:+0'); }); 

Anyone have any ideas on what could cause Chrome to crash?

+4
source share
2 answers

actually ... heres my solution: theres some question with the width of the year selection element the exact line in css is the following: .ui-datepicker select.ui-datepicker-month, .ui-datepicker select.ui-datepicker-year {width: 49%;}

if you change it to some percentage value, it corrects it ... something like this: .ui-datepicker select.ui-datepicker-month, .ui-datepicker select.ui-datepicker-year {width: 75px;}

hope this helps, Marcelo

+2
source

FIXED!

I had the same problem. I really found that this is a problem with the CSS files that I used ... namely:

 jquery.ui.core.css jquery.ui.theme.css jquery.ui.datepicker.css 

I have no idea why this is ... Debugging in chrome is not as enjoyable as firefox .. but my simple fix was to re-download the desired theme and fix the problem.

hope that helps

J


I have the same problem. Does anyone have a fix? someone posted a potential work here: http://groups.google.com/group/jquery-ui/browse_thread/thread/1ea5315618087a9d?pli=1

(by wrapping setTimeout around what the user identified as a problem, but that didn't help me either.)

0
source

Source: https://habr.com/ru/post/1301419/


All Articles