Client side solution
To show/hide element use plain JavaScript / jQuery (example) / other JS library in the client code:
<p:commandLink value="Toggle" onclick="$('#MyForm\\:OnUse').toggle('slow'); return false;" />
Server side solution
To enable / disable, or render / not render, add appropriate tag condition in the server code:
<p:commandLink value="Toggle" action="#{bean.action}" update="placeholder" />
<h:panelGroup id="placeholder" layout="block">
<p:inputTextarea id="OnUse" size="15" rendered="#{bean.rendered}" disabled="#{bean.disabled}" />
</h:panelGroup>
with bean:
@ManagedBean
@ViewScoped
public class Bean implements Serializable {
private boolean rendered = true;//getter
private boolean disabled = false;//getter
public String action {
//use some model condition to derive new rendered property value
rendered = !rendered;//or disabled = !disabled;
return null;
}
}
Be sure to understand the client/server code distinction though. Also note that setting attributes of JSF components is to be done solely on the server, otherwise, if you decide to change them via JavaScript, the changes won't have any effect.