i'm doing project in primefaces. need when commandbutton click focus specify id.
<h:form> <p:inputtext id="displaytext"/> <p:commandbutton id="button1" value="press" onfocus="displaytext.focus()"/> <p:commandbutton id="button2" value="press"> <p:ajax event="click" oncomplete="displaytext.focus()"/> </p:commandbutton> </h:form>
when try click button1 , button2 not focus specify id.i use p:focus page load want when press button focus id.