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