how to check if modal panel is opened using javascript
Don't know how to check if modal Panel has been opened or not.
<a4j:commandButton id="backButtonId" value="#{msg.back}"
action="#{someCommonAction}"
oncomplete="if ( MyModalPanel Has Been Opened) #{rich:component('MyModalPanel').开发者_如何学JAVAhide() else Nothing;"
/>
How can i do it with javascript but not using managed beans?
thank you for your answers in advance.
You could use jQuery.is()
for this wherein you check if the element is :visible
.
oncomplete="if (#{rich:component('MyModalPanel')}.is(':visible')) #{rich:component('MyModalPanel')}.hide();"
But this is useless. It doesn't harm to call hide()
on an already hidden modal panel.
oncomplete="#{rich:component('MyModalPanel')}.hide();"
The following should do the trick for you:
#{rich:component('MyModalPanel')}.shown
精彩评论