Checkbox not checkable in dialog ui

最后都变了- 提交于 2019-12-06 05:27:00

You have to set the z-index on #dialog, not #interface.

Your code is throwing an error because you're trying to assign a value to a function call. So your code should be:

$('#interface').click(function(evform){
  $('#dialog').css('z-index', 99999);
});

Or just this on your CSS:

#dialog { z-index: 99999; }

UPDATE

This solution is not bullet-proof. The bug report filed for jQueryUI states that the problem happens if the checkboxes have a z-index lower than the overlay below the dialog. jQueryUI seems to be comparing z-indexes in an absolute manner, which goes against the CSS standard (but is understandable, considering a proper comparison would probably be resource-intensive).

So the actual solution may depend on which elements you're setting z-index (and position) inside the dialog. To avoid the bug, no not use z-index inside the dialog, or set a value guaranteed to be higher than what will be (dynamically) assigned to the overlay (hence, my 99999 suggestion).

$('#interface').click(function(evform){
  $('#interface').prop('z-index')=99999;
});

should be

$('#interface').click(function(evform){
  $('#interface').prop('z-index', 99999);
});

The second argument (if provided) sets the property to its value.

The problem turns out to be the return false; I had in my click coding:

$('#interface').click(function(evform){
  *** did stuff here ***

   evform.preventDefault;
   return false; //This is the offending line of code
});

For diagnosis, I wanted to see what had a higher z-index on the page, so I added:

$('*').each(function(){
    if ($(this).css('z-index')>99) { 
        console.log ($(this).css('z-index')+", " + $(this).prop('class'));
    }
});

which gave me all elements with a z-index higher than 99. It turns out that the ui-dialog was normally set to 1001 or 1002, so the '99999' listed by @bfavaretto was more than high enough.

Still don't know why the return false; created the error, but I hope the next update fixes the problem.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!