Manually setting focus to a <lockup> element in TVJS

為{幸葍}努か 提交于 2020-01-25 12:25:27

问题


I can't find any method in the Documentation to manually set the focus to an element. It is supposed to support the DOM Element class, but when i do

var elem = ele.ownerDocument.getElementById("start");
elem.focus();

it does nothing. elem is correctly set, but it doesn't recognize the focus() method.


回答1:


Apple's TVJS Framework doesn't provide any method in his classes to manually focus an element.

Neither in the standard Document Object Module classes it incorporates have any kind of method to directly access the DOM and focus an element.

The closes thing available is the autoHighlight attribute which allows to focus on render some specific elements in certain positions.




回答2:


In pure js you can document.getElementById("start").autofocus; : On page load input is autofocus




回答3:


Use autoHighlight for this purpose.

autoHightlight="true"

Both the containing element and one child element have to be set to true.



来源:https://stackoverflow.com/questions/34063246/manually-setting-focus-to-a-lockup-element-in-tvjs

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