jQuery鼠标悬停禁用了在密码结束时按回车键的功能
jQuery mouseover disables ability to hit return at end of password to login
PeopleSoft的浏览器选择Internet Explorer,但不支持:hover。为了模拟:悬停在登录按钮上,我添加了以下脚本:
$(function(){
$(".fg-button:not(.ui-state-disabled)")
.hover(
function(){
$(this).addClass("ui-state-hover");
},
function(){
$(this).removeClass("ui-state-hover");
}
)
.mousedown(function(){
$(this).parents('.fg-buttonset-single:first').find(".fgbutton.ui-stat e-active").removeClass("ui-state-active");
if( $(this).is('.ui-state-active.fg-button-toggleable, .fg-buttonset-multi .ui-state-active') ){ $(this).removeClass("ui-state-active"); }
else { $(this).addClass("ui-state-active"); }
})
.mouseup(function(){
if(! $(this).is('.fg-button-toggleable, .fg-buttonset-single .fg-button, .fg-buttonset-multi .fg-button') ){
$(this).removeClass("ui-state-active");
}
});
});
与下面的html
<button class="fg-button ui-state-default ui-corner-all" type="button" name="Submit" onClick="submitAction(document.login)">Sign In</button>
只是现在,而不是按enter一旦你已经完成了你的密码,你就会自动登录,而不需要像许多开发人员那样点击登录按钮-你现在必须点击登录按钮来启动登录过程。这给那些不想点击"登录"按钮的人造成了很大的困扰。没有好的无障碍行为不受惩罚。
完整的代码在http://jsfiddle.net/maniator/2NCHd/1/IE 7及更高版本支持:悬停在任意元素上,只要浏览器处于标准模式而不是古怪模式——只要确保启用了正确的文档类型。
如果你还支持ie6,我很同情你。在这种情况下,您可以尝试添加whatever:hover浏览器行为。就我个人而言,在这种情况下,我会切换到严格的文档类型以支持ie7 +,并使用条件注释将浏览器行为仅应用于ie6。
并且,正如@mootinator在上面评论的那样,您总是可以添加更多的JavaScript来触发表单提交,当焦点在表单字段中时,有人按enter键。
相关文章:
- 添加文字和评论功能更新Div
- JavaScript打印功能使日历停止工作
- 每当您在选择器内移动鼠标时,悬停功能就会重复
- 如何防止网页加载后自动启动功能
- 除修剪外的其他功能
- 悬停功能触发器
- 使用angularjs向浏览器发送servlet响应(下载功能)
- 删除CKEditor工具栏按钮,但不删除功能
- 异步facebook功能
- 如何将chrome扩展功能移植到移动设备(特别是jquery和trello)
- jQuery滚动功能只工作一次
- Graphiti中是否有任何工具提示功能
- React redux初始化功能,无论状态变化如何
- 在哪里可以学习ECMAScript标准中尚未包含的JavaScript功能
- 正在获取select上的功能id
- Rhino打印功能
- chrome使用execCommand('copy')添加回车
- 使用(navigator.geolocation)检测浏览器功能错误
- 主体单击删除功能上的输入框宽度
- JQuery使用相同的功能自动完成各种输入文本