Here is the situation. For example I have code like this
<a4j:commandButton action=XXX reRender="scriptPanel" ....../>
<a4j:outputPanel id="scriptPanel">
<a4j:commandButton id="buttonToDisableWithJS" action=YYY ....../>
*** I want to insert JS here which will be executed after every reload of outputPanel with id="scriptPanel" and will disable/enable commandButton with id="buttonToDisableWithJS"***
</a4j:outputPanel>
How can I do this since inserting just
<script type="text/javascript">
.......
</script>
doesn't work for me (it's not invoked when panel is rerendered).
PS: i cannot use "disabled" attribute of a4j:commandButton since when disabled="true" then onclick for button is generated as onclick="return false;" (it doesn't generate the same js code as when disabled="false" for onclick event) but button can be enabled and used later with other part of js on the page and onclick="return false;" it's not what expected from button in the case.