Jqueryui datepicker error in zIndex related code

I am developing an asp.net page / application. I created a text box that I set as datepicker using datepicker from jqueryui. in firefox and chrome datepicker does not display. in IE9, the date selection displays if I ignore the error. the error is on line 644 in jquery.ui.datepicker.js.

the error code is called here.

inst.dpDiv.zIndex($(input).zIndex()+1);

this is a message displayed by VS when it catches an error

Microsoft JScript runtime error: object does not support this property or method

I am not sure what causes the problem. I searched for problems with zindex, and the ones I find are related to the dialog appearing behind other elements. I do not have it.

+7
jquery jquery-ui datepicker
source share
8 answers

.zIndex () is not a jQuery method (search in jQuery API, nothing there)

You should use .css ('z-index', '100')

Also note:

Whenever I work in ASP.NET, I do not use the $ sign to access jQuery, I use

 inst.dpDiv.zIndex(jQuery(input).zIndex()+1); 

Depending on which ASP.NET platform you use Win Forms, MVC, etc. embedded MSFT Ajax may interfere with jQuery.

+3
source share

Add jquery.ui.core.js will be OK

+26
source share

I had the same problem and fixed it, making sure that I had the most recent jQuery jQuery and jQuery UI.

 <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js"></script> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/jquery-ui.min.js"></script> 
+7
source share

Use this:

 $.zIndex = $.fn.zIndex = function (opt) { var def = { inc: 10, group: "*" }; $.extend(def, opt); var zmax = 0; $(def.group).each(function () { var cur = parseInt($(this).css('z-index')); zmax = cur > zmax ? cur : zmax; }); if (!this.jquery) return zmax; return this.each(function () { zmax += def.inc; $(this).css("z-index", zmax); }); } 
+1
source share

I have included (core files)

  ui.css and ui.core.js files 

This works for me ..

+1
source share

Axel22 gave the correct answer to solve this problem for me.

This is because the jquery-ui-datepicker.js script depends on the jquery-ui-core.js script.

This is clearly visible on the jQuery Datepicker Documentation page on the Overview tab on the right, there is a list of dependencies.

0
source share

Add a script link (../Scripts/jquery.ui.core.js), it will work. Refer to the jquery.ui.core.js library.

0
source share

This is my decision:

 //inst.dpDiv.zIndex(jQuery(input).zIndex()+1); //we don't need it anymore $.zIndex = '30000'; // i set the zindex at the higher value 
-one
source share

All Articles