Skip to main content

Posts

Showing posts with the label primefaces

JSF2.0 - InputTextArea inside Dialog cannot be retrieved via Jquery during the dialog"s onShow event

I have the following dialog inside my .xhtml page. <p:dialog widgetVar="exampleDialog" onShow="fillTextArea()" > <p:tabView id="tabView"> <p:tab id="exampleTab" title="Example"> <p:inputTextarea id="someInputTextArea" autoResize="false" value="" /> </p:tab> </p:tabView> </p:dialog> The dialog is shown when a button is clicked. The fillTextArea javascript function is defined inside script tags at the head of the document. function fillTextArea() { console.log(jQuery("textarea[id='someInputTextArea']")); // logs empty array [] console.log($("[id='someInputTextArea']")); // logs empty array [] jQuery("textarea[id='someInputTextArea']").val('xxx'); // does nothing } What's the problem? Why can't I retrieve the input text area? In