Here is something so simple
<p:commandLink value="Tom" onclick="document.getElementById('tom').focus()"/><br/>
<input id="tom"/>
When u click on the Tom, the textbox get focus. Great, now try this
<p:commandLink value="Tom" onclick="document.getElementById('tom').focus()"/><br/>
<h:inputText id="tom"/> <br/>
when I click nothing happen, I check firebug, I see
document.getElementById("tom") is null
When I try to use jQuery $('#tom').focus()
, nothing happen, no error, but did not get focus either. This is the response
(not sure if this is the response from the server) when I see from firebug
<?xml version="1.0" encoding="utf-8"?>
<partial-response>
<changes>
<update id="javax.faces.ViewState"><![CDATA[455334589763307998:-2971181471269134244]]></update>
</changes>
<extension primefacesCallbackParam="validationFailed">{"validationFailed":false}</extension>
</partial-response>