IE8 - 隐藏div中的表单,返回键不再有效 [英] IE8 - Form within a hidden div, return key no longer works
本文介绍了IE8 - 隐藏div中的表单,返回键不再有效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个登录表单,位于div中,显示:none;然后我使用jquery淡入表单,但Enter / Return键不再提交表单。如果我将显示更改为阻止,它可以正常工作。这个问题只是IE浏览器。
I have a login form that resides within a div with display: none; I then fade in the form using jquery but the Enter/Return key no longer submits the form. If I change the display to block, it works fine. This problem is IE only.
任何想法?
这是一个不起作用的示例代码;
Here's an example code that doesn't work;
<div id='formdiv' style='display: none;'>
<form id='loginForm' name='createLoginForm' method='post' action='' >
<input type='text' name='username' id='username' />
<input type='password' name='password' id='password' />
<input type='submit' name='submit' id='login_submit' />
</form>
</div>
我坚持要测试隐藏/显示;
And I stuck this in the to test the hiding/showing;
<script type="text/javascript" src="jquery.tools.min.js"></script>
<script type='text/javascript'>
setTimeout('$("#formdiv").show()',1000);
</script>
推荐答案
因为问题似乎与元素,你仍然可以看到它,但是使用带溢出的1x1包装div隐藏它:hidden;
Since the problem seems relevant to whether the element appears on the page or not, you can still have it appear, but "cloak" it using a 1x1 wrapper div with overflow: hidden;
<style type="text/css" media="screen">
.submit-wrapper
{
overflow: hidden;
height: 1px;
width: 1px;
position: absolute;
top: 0;
right: 0;
}
</style>
<div class="submit-wrapper">
<input type="submit" value="Save" />
</div>
这篇关于IE8 - 隐藏div中的表单,返回键不再有效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文