Ajax 页面加载时自动将焦点设置在p:编辑器上
如何在页面加载时自动设置焦点Ajax 页面加载时自动将焦点设置在p:编辑器上,ajax,jsf,primefaces,facelets,Ajax,Jsf,Primefaces,Facelets,如何在页面加载时自动设置焦点 加载页面后,我希望能够在编辑器中写入,而无需额外单击编辑器面板。Primefaces提供属性“widgetVar”,因此您可以从客户端获取元素并将其聚焦: <h:head> <script type="text/javascript"> function test() { xxx.focus(); } </script>
加载页面后,我希望能够在编辑器中写入,而无需额外单击编辑器面板。Primefaces提供属性“widgetVar”,因此您可以从客户端获取元素并将其聚焦:
<h:head>
<script type="text/javascript">
function test() {
xxx.focus();
}
</script>
</h:head>
<h:body onload="test()">
<h:form id="form">
<p:inputText id="rongnk" value="test"/>
<p:editor widgetVar="xxx" id="nkrong" value="123" width="600"/>
</h:form>
</h:body>
功能测试(){
xxx.focus();
}