Onclick button show div (the div should hide the button in the process)
Hey all i have div and within this div i have a form. I want to show this div when a button is clicked. This all works fine but i also want the original button to be hidden when clicked upon (basicly i want the div to be on top of the button hiding it) When the div is closed (by completing the form or clicking on the hide button i want the div to dissapear and the button to reappear (all without realoading the page) How can i achieve this.
-
- <div id='d1' style="display: none;">
-
- <form>
- <input type="text">
- <input type="submit">
- </form>
- <button id='b2'> Hide Form </button>
- </div>
- <button id='b1'> Show form </button>
-
- ///show///
- $('#b1').click(function(){
- $('#d1').show();
- })
- ///hide///
- $('#b2').click(function(){
- $('#d1').hide();
- })