Remove focus programmatically?

こ雲淡風輕ζ 提交于 2019-12-22 01:13:05

问题


I have a jquery ui dialog with tabs loaded dynamically/JSON with content. Due to the complexity, I can't really post a fiddle or a relevant code (too much code).

What's happening is that when the dialog opens, you can tab through the elements within the dialog, up to the first tab. After that, you cannot tab through to anywhere else. The focus is locked on that tab, even if you click elsewhere, that focus is locked on that tab.

I am unable to locate the actual cause of this issue.

So, how would I remove the focus programmatically?


回答1:


This might help...

http://api.jquery.com/blur/

$('#tabName').blur();



回答2:


Try triggering a blur event on the field you want to lose focus.




回答3:


I'd put in a load of alerts to find where the JS is failing. E.g.

alert(1);
var a = 10;
alert(2);
var b = null;
alert(3);
a += 5;
alert(4);
b.hello();
alert(5);

Obviously in this example the last alert will be 4.

It is not a nice approach but everyone has to do it at some point.



来源:https://stackoverflow.com/questions/7954205/remove-focus-programmatically

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!