How do I automatically set the focus on <p:editor> on page load?
After page is loaded I would like to be able to write in the editor without an additional click on the editor panel.
Primefaces provide attribute 'widgetVar', so you can get element from client and focus it:
<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>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With