Currently utilizing Bootstrap 4.3.1, attempting to switch between two divs where one is displayed and the other is hidden.
Functionality is as expected, however, there seems to be an issue with Bootstrap columns not rendering properly within the initially hidden div due to the CSS used to hide it (display:none;)
So - form1 is initially hidden while form2 is visible.
Clicking a button toggles their visibility.
The toggle works, but form1's display appears like:
blah blah
blah blah
blah blah
Instead of being in three columns (col-md-4):
blah blah | blah blah | blah blah
Here is the code snippet:
$('.togglebutton').on('click', function (e) { var frm = $(this).closest('.frm'); frm.find('.form1').toggle(200, 'swing'); frm.find('.form2').toggle(200, 'swing'); });
.hidden {display:none !important;}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.3.1/css/bootstrap-grid.min.css" integrity="sha256-D9AvR0EzkNZoWZVSvI3ch+uf/Z5izrIpcbsykVphwPU=" crossorigin="anonymous" /> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.3.1/css/bootstrap-reboot.min.css" integrity="sha256-dARYuC3pd0wa/7R4Hkt/sR2zfLHCgbnVAQ2sPwhNe0A=" crossorigin="anonymous" /> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha256-YLGeXaapI0/5IgZopewRJcFXomhRMlYYjugPLSyNjTY=" crossorigin="anonymous" /> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <div class="row frm"> <div class="row form1 hidden"> <div class="col-md-4"> 1blah blah </div> <div class="col-md-4"> 1blah blah </div> <div class="col-md-4"> 1blah blah </div> </div> <div class="row form2"> <div class="col-md-4"> 2blah blah </div> <div class="col-md-4"> 2blah blah </div> <div class="col-md-4"> 2blah blah </div> </div> </div> <button class="btn btn-outline-success togglebutton" type="submit">Edit</button>
Tried various methods such as using '.d-none' from Bootstrap instead of '.hidden', and utilizing 'collapse' with jQuery, but none have resolved the column display issue in form1.
Any insights or suggestions would be highly appreciated.