简体   繁体   English

<p:focus does not work when it is in a p:tabView

[英]<p:focus does not work when it is in a p:tabView

<P:focus tag works fine in normal forms but when the form is in the second tab of a p:tabView it does not work. <P:focus标记在正常形式下可以正常工作,但是当该形式位于p:tabView的第二个选项卡中时,它将不起作用。

What is the solution the set the focus of the first input of the form when the tab is selected? 选择选项卡时设置表单的第一个输入焦点的解决方案是什么?

Based on your hint I solve the problem this way: 根据您的提示,我可以通过以下方式解决问题:

onTabShow="tabShowHandler()"

And the javascript part: 和javascript部分:

function tabShowHandler() {
   var inputUsername = $('#tabView\\:frmRegister\\:username');
   inputUsername.focus();
}

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

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