Wednesday, April 12, 2017

How to get HTML element from PrimeFaces

In some scenarios, we might want to get the HTML element of a PrimeFaces component and process in javascript.
Assume we have a PrimeFaces inputText component like below.


<p:inputText id="address" value="#{myBean.address}" widgetVar="addrWV" />



1. widgetVar

addrWV.jq.get(0);



2. #{p:component('compId')}

document.getElementById('#{p:component(&quot;address&quot;)}');




Done!!

LinkWithin

Related Posts Plugin for WordPress, Blogger...