这是非常简单的事情
<p:commandLink value="Tom" onclick="document.getElementById('tom').focus()"/><br/>
<input id="tom"/>
当你点击汤姆时,文本框获得焦点。太好了,现在试试这个
<p:commandLink value="Tom" onclick="document.getElementById('tom').focus()"/><br/>
<h:inputText id="tom"/> <br/>
当我点击什么都没有发生时,我检查了萤火虫,我看到了
document.getElementById("tom") is null
当我尝试使用 jQuery$('#tom').focus()
时,什么也没有发生,没有错误,但也没有得到焦点。当我从萤火虫看到时,这是response
(不确定这是否是服务器的响应)
<?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>