Hello I have a problem with select2, I have a project in laravel where I have a table where I list the data to display and in the last boxes of my table in all the data I use a button that opens a modal
to differentiate the modal uses a name plus a hyphen and the id of the data:
<!-- Button trigger modal -->
<button type="button" class="btn btn-outline-success" data-toggle="modal" data-
target="#examplemodal-{{$user->id}}">
<i class="fas fa-folder-plus"></i>
</button>
<!-- Modal -->
<div class="modal fade" id="examplemodal-{{$user->id}}" tabindex="-1" aria-
labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered modal-xl">
<div class="modal-content">
<div class="modal-body">
<div class="card card-body">
{!! Form::open(['url' => '/date','files'=>'true']) !!}
{{Form::token()}}
<div class="row">
<div class="form-group col-4" id="select">
<label for="name">Users:</label><br>
<select name="entidad_id" class="form-control selectAdmwn" style="width:100%">
<option value="{{$user->user_id}}">{{$user->name}}</option>
</select>
</div>
</div>
{!! Form::submit('Guardar',['class' =>'btn btn-primary btn-lg']) !!}
{!! Form::close() !!}
</div>
</div>
</div>
</div>
but in that modal I use the select2 to have a quick access to the data of a select but as the id of my modal has that structure already shown in the code above the select2 stops working.
I have seen that they use this code to solve but in that case they use a unique id for a modal in my case I use several modals how could I do it?
$(document).ready(function(){
$('#tecnics').select2({
dropdownParent: 'modal-id'
});
});
