gpt4 book ai didi

ajax - 自动将焦点设置在 p :editor on page load

转载 作者:行者123 更新时间:2023-12-02 00:09:48 24 4
gpt4 key购买 nike

如何自动将焦点设置在 <p:editor> 上在页面加载时?

页面加载后,我希望无需在编辑器面板上额外单击即可在编辑器中编写。

最佳答案

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>

关于ajax - 自动将焦点设置在 p :editor on page load,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16016709/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com