I have 2 divs with a button above it. At the beginning you see only 1 div, and that will be divcatalogusOrderBox. If I press the button: manualButton (which will be shown above the div), then it should display the divOurderBox and hide the divus catalogusOrderBox. But then it is also necessary to change the button text (from the "Manual button" to the "Catalogus" button) so that the user opens the divus catalogusOrderBox again, so if you then click on this button, he must again display the usOrdersBox directory and hide the manual control. >
At the moment I have this and it does not work:
<script type="text/javascript"> $(document).ready(function(){ $('.manualOrderBox').hide().before('<a href="#" id="toggle-manualOrderBox" class="manualButton">manual order box</a>'); $('a#toggle-manualOrderBox').click(function() { $('.manualOrderBox').slideToggle(1000); if($('.manualOrderBox').is(":visible")){ $('.catalogusOrderBox').hide(); $('.manualOrderBox').visible = false; }else{ $('.manualOrderBox').visible = true; $('a#toggle-manualOrderBox').text('catalogus orderBox'); $('.catalogusOrderBox').show(); } return false; }); }); </script> <div class="manualOrderBox">
see also https://jsfiddle.net/Lbot8a8b/ live in action
source share