3

Bootstrap Select-box shows multiple times in bootstrap modal wizard. how to fix that? the image is shown below:

i have tried many things from stack questions but no use.

enter image description here

My html/php part is below:

<div class="wizard" id="satellite-wizard" data-title="Create Server">
    <div class="wizard-card wizard-card-overlay" data-cardname="location">
        <div class="wizard-input-section">
        <select name="location" data-placeholder="Monitor nodes" style="width:350px;" class="chzn-select">
            <option value=""></option>
            <option>Atlanta</option>
            <option selected>Chicago</option>
            <option>Dallas</option>
        </select>
        </div>
    </div>
</div>

JS Code

    $(document).ready(function() {
        $.fn.wizard.logging = true;
        var wizard = $('#satellite-wizard').wizard({
            keyboard : false,
            contentHeight : 400,
            contentWidth : 700,
            backdrop: 'static'
        });

        $(".chzn-select").chosen();

        wizard.on('closed', function() {
            wizard.reset();
        });

        $('#open-wizard').click(function(e) {
            e.preventDefault();
            wizard.show();
        });
    });
Fahad Almehaini
  • 233
  • 3
  • 18

1 Answers1

0

When Bootstrap Select gets applied it actually creates a copy of your select and hides the original. If you are seeing 2 of your selects it's because the hide process failed. The usual trick to resolve this is to add this line (usually in the done callback of the Ajax request that populates the select)

$('.selectpicker').selectpicker('refresh')

TrojanName
  • 4,853
  • 5
  • 29
  • 41