-
1. Re: hide/show div in rich faces
ahoehma Feb 17, 2010 6:05 AM (in response to sathish1712)You can use jQuery ...
<h3>Inside form</h3>
<h:form>
<p>
<div id="div1">
Foobar 1<br/>Huhu
</div>
<div onclick="jQuery('#div1').hide();"
style="cursor: pointer; border: 1px solid black; width: 50px; background-color: #DDD;">Hide</div>
<!-- onclick return false to avoid submit-->
<button onclick="jQuery('#div1').show(); return false;"
style="cursor: pointer; border: 1px solid black;">Show</button>
<!-- onclick return false to avoid submit-->
<a4j:commandButton onclick="jQuery('#div1').slideToggle(600); return false;"
style="cursor: pointer; border: 1px solid black;"
value="Toggle"/>
</p>
</h:form>
<h3>Without form</h3>
<p>
<div id="div2">
Foobar 1<br/>Huhu
</div>
<div onclick="jQuery('#div2').hide();"
style="cursor: pointer; border: 1px solid black; width: 50px; background-color: #DDD;">Hide</div>
</p> -
2. Re: hide/show div in rich faces
harut Mar 5, 2010 7:14 AM (in response to sathish1712)You can use a simple javascript by setting style of the div "display:none"
function showHide() {
var divElementStyle = document.getElementById('divId').style;
if(divElementStyle.display == ""){
divElementStyle.display = "none";
} else {
divElementStyle.display = "";
}
}Regards, Harut.
-
3. Re: hide/show div in rich faces
nbelaevski Mar 5, 2010 2:33 PM (in response to sathish1712)Hello,
If you want exactly the same functionality as on demo, use rich:effect component.