jQuery UI模式对话框捕获所有按键,因此我无法在其中输入文本 [英] jQuery UI modal dialog captures all keypress so I can't input text inside it

查看:85
本文介绍了jQuery UI模式对话框捕获所有按键,因此我无法在其中输入文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个模态对话框,其中包含表单(带有一些文本输入). 而且我只是无法在文本框中输入文本.对话框阻止键盘输入.

I create modal dialog with form inside it (with some text input). And I just can't enter the text inside the textbox. Dialog blocks keyboard input.

这是我的简化示例:

<div id="modal-dialog">
    <label for="my-text">TRY to input text...</label>
    <textarea id="my-text" style="position:relative; z-index:1"></textarea>
</div>
<script type="text/javascript">
    var dialog = $('#modal-dialog').dialog({ modal: true });
</script>

注意:您可能会问-为什么我提到"position:relative; z-index:1"?因为没有它,它就可以正常工作.但是由于设计原因我无法将其删除.

Note: You may ask - why did I mentioned about "position:relative; z-index:1"? Because it works fine without it. But I can't remove it because of design.

注意:非模态对话框也可以正常工作.

Note: not modal dialog works fine too.

我正在使用jQuery 1.6.2 + jQuery UI 1.8.14

推荐答案

z-index是问题.这是具有较大z索引的代码示例( http://jsfiddle.net/c3BPP/),并且可以正常工作.

The z-index is the problem. Here is an exemple ( http://jsfiddle.net/c3BPP/ ) of your code with a bigger z-index and it works.

这篇关于jQuery UI模式对话框捕获所有按键,因此我无法在其中输入文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆