I have little experience with front-end development, needles to mention that web ui is out of my planet..
The problem I need to show and hide an element, on the onClick event of a button. The technology stack is JSF with PrimeFaces, for the script we use JavaScript.
Basically - how can I get reference to the element that I need to show/hide? And can you give me a clue why the line (below) in comment works good?
function test(id, id2){
var element =$(document).get("#testEl");
$(element).show(); //this doesn't work??? although I get no errors executing it..
// $("#tab-view\\:template-form\\:testEl").show(); // <-- however this works? Why?
$(btn).css("display", "none");
}
The html:
<p:commandButton widgetVar="edit" id="edit" value="Edit" onclick="test(this, #testEl)" type="button"/>
<p:panel widgetVar="opa" id="testEl" closable="false" visible="false" >
<h:panelGrid ..>....
</h:panelGrid>
</p:panel>
Thanks!