IE 输入不同行为选择文本或不选择文本
我发现 IE 中文本输入的行为非常奇怪。 我想在表单提交时更改光标,这可以通过按 Enter 键来完成。
/* IE hack for on enter submit */
$('input').live('keydown', function(e){
if (e.keyCode == 13) {
$(this).parents('form').find(".submit").trigger("click");
return false;
}
});
由于 IE 在移动后更改光标,我必须通过使用光标:进度; 分配页面特殊类上的所有元素来破解它。使其立即发挥作用。
$("form.ajax").live("submit", function () {
$("#load_dialog").show(); /show loading dialog
if($.browser.msie){ /IE hack
$("*").addClass("waiting"); /assign class with loading cursor
}
$(this).ajaxSubmit(); /submit a form
return false;
});
这很有效,但有一个奇怪的问题。 当我单击输入(选择文本)并按 Enter 键而不更改文本时,会(重复)出现加载光标,但是当我编辑文本然后按 Enter 键时,光标不会改变。
你不知道为什么吗?
i found really strange behavior of text input in IE.
I want to change cursor upon form submit, which can be done by hitting enter key.
/* IE hack for on enter submit */
$('input').live('keydown', function(e){
if (e.keyCode == 13) {
$(this).parents('form').find(".submit").trigger("click");
return false;
}
});
As IE change cursor after move i have to hack it with assigning all elements on page special class with cursor:progress; making it work immediately.
$("form.ajax").live("submit", function () {
$("#load_dialog").show(); /show loading dialog
if($.browser.msie){ /IE hack
$("*").addClass("waiting"); /assign class with loading cursor
}
$(this).ajaxSubmit(); /submit a form
return false;
});
This works great, but with one strange issue.
When i click input (select text) and hit enter without changing text, loading cursor appears (repeatedly), but when i edit text and then hit enter, cursor do not change.
Don't you have any ideas why?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我会将其更改
为:
或者,如果您使用的是 jQuery 1.7,则
on
应该优先于live
,因为后者已被弃用且效率低下对于 pre -1.7
delegate
是下一个最好的事情:I would change this:
to this:
Or, if you're using jQuery 1.7, then
on
should be preferred tolive
, since the latter is deprecated and inefficientAnd for pre-1.7
delegate
is the next best thing: