简体   繁体   English

如何删除焦点在Tab键上按下jquery对话框上的关闭按钮

[英]how to remove focus on tab key press on the close button on jquery dialog

How can i remove the focus on close button in jquery dialog when tab key is pressed.For buttons i have used tab-index=-1 and it worked. 当按下Tab键时,如何在jquery对话框中将焦点移到关闭按钮上?对于按钮,我使用了tab-index = -1并且有效。 Attaching the 附上

 $('.ui-widget-content').blur();
 $('.ui-widget-content :button').blur();
 $('.ui-dialog-titlebar-close :link').blur();
 $('.ui-dialog-titlebar-close :button').blur();
 $('.ui-icon').blur();            
 $('.ui-icon-closethick').blur();
 $('.ui-dialog').removeClass('ui-state-focus');

http://jsfiddle.net/bharatgillala/a0ft8dm3/1/ http://jsfiddle.net/bharatgillala/a0ft8dm3/1/

I have tried the above statements but did not work for me. 我已经尝试了以上陈述,但对我没有用。

Add tabindex="-1" to close button and trigger blur event on it. tabindex="-1"添加到关闭按钮并触发模糊事件。 You don't need most of the stuff you tried, it can be as simple as 您不需要尝试的大多数东西,它可以很简单

$(function () {
    $("#dialog").dialog();
    $('.ui-dialog-titlebar-close').attr('tabindex', '-1').blur();
});

Demo: http://jsfiddle.net/a0ft8dm3/4/ 演示: http //jsfiddle.net/a0ft8dm3/4/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM