Onclick button show div (the div should hide the button in the process

by Akram kamal

HTML

<div id='d1' style="display: none;">
    <form>
        <input type="text">
        <input type="submit">
    </form>
    <button id='b2'>Hide Form</button>
</div>
<div id="d2">
    <button id='b1'>Show form</button>
</div>

JavaScript

$('#b1,#b2').click(function () {
    $('#d1,#d2').toggle();
})