0
I’m trying to use the Bootstrap + Chosen But it just doesn’t work. I’ve done all the Imports and nothing
The Times I did so:
<link href="{{ asset('css/chosen.min.css') }}" type="text/css" rel="stylesheet" >
<script src="{{ url('js/bootstrap.js') }}"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.3/jquery.min.js" integrity="sha384-I6F5OKECLVtK/BL+8iSLDEHowSAfUo76ZL9+kGAgTRdiByINKJaqTPH/QVNS1VDb" crossorigin="anonymous"></script>
<script src="{{ url('js/chosen.jquery.min.js') }}"></script>
What I would like to happen is more or less as follows in the code below
$('.btn-botao').on('click', function(){
$('.modal').modal('show');
});
$('.modal').on('shown.bs.modal', function () {
$('select', this).chosen('destroy').chosen( {allow_single_deselect: true} );
});
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/chosen/1.8.2/chosen.min.css" rel="stylesheet"/>
<link href="https://cdnjs.cloudflare.com/ajax/libs/chosen/1.8.2/chosen.css" rel="stylesheet"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/chosen/1.8.2/chosen.jquery.min.js"></script>
<a href="#" class="btn btn-primary btn-botao">Clique aqui</a>
<div class="modal fade">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Modal title</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<select class="form-control" data-placeholder="Selecione">
<option value="0"></option>
<option value="1">Opção 1</option>
<option value="2">Opção 2</option>
</select>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary">Save changes</button>
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
Help me, Please!
Yes, because on another page where I do not use modal, it works
– adventistaam
didn’t work either
– adventistaam
I’ll take a closer look and rewrite the answer then.
– Darlei Fernando Zillmer
Blz. Thank you..
– adventistaam
I found out. Just change your
show
forshown
– adventistaam