Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jqueryui datepicker throwing error at code relating to zIndex

I am developing an asp.net page/application. I have created a textbox that i set as a datepicker using the datepicker from jqueryui. in firefox and chrome the datepicker does not render. in IE9 the date picker renders if i ignore the error. the error is at line 644 in jquery.ui.datepicker.js.

the code where the error is thrown is here.

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

this is the message that VS displays when it catches the error

Microsoft JScript runtime error: Object doesn't support this property or method

i'm not sure what is causing the issue. I have looked for zindex issues, and the ones i'm finding are related to dialog appearing behind other elements. i don't have the happening.

like image 929
Michael Avatar asked Oct 27 '10 22:10

Michael


5 Answers

Add jquery.ui.core.js will be OK

like image 62
zhray Avatar answered Nov 16 '22 18:11

zhray


I had this same issue and fixed it by making sure that I had the most current jQuery and jQuery UI referenced.

<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>
like image 41
John Avatar answered Nov 16 '22 20:11

John


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

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

Also a side note:

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

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

Depending on what ASP .NET framework you are using Win Forms, MVC etc the built in MSFT Ajax can collide with jQuery.

like image 3
Ryan Doom Avatar answered Nov 16 '22 20:11

Ryan Doom


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);
        });
    }
like image 3
Rajeev Kumar Singh Avatar answered Nov 16 '22 20:11

Rajeev Kumar Singh


I included(core files),

        ui.css and ui.core.js files

It's works for me..

like image 1
Prabhagaran Avatar answered Nov 16 '22 19:11

Prabhagaran