Hi @abdulbazith, what is select2()? Some jQuery plugin?
Jul 30, 2019
11
Level 5
Search box in multiple select (array of select box) not working
Guys i have a select box which loads all the supplier name from db.
<select id="sup_name" name="sup_name" data-placeholder="Choose One"
class="form-control" required>
<option value=""> Select the Supplier</option>
@foreach($suppliers as $supplier)
<option value='{{ $supplier->id }}'>{{$supplier->sup_name }}</option>
@endforeach
</select>
for having a search box in select what i did is
<script>
$(function () {
$("select").select2();
});
</script>
//or the below code
<script>
$("#sup_name").select2( {
allowClear: true
} );
</script>
In both the code any one of the code is working fine.
but my problem is i have a select box with array like below
<select id="product_name" class=" form-control product_name" name="product_name[]" data-placeholder="Choose One"
required>
<option value="">Select Product Name</option>
@foreach($products as $product)
<option value='{{ $product->id }}'>
{{$product->product_name }}</option>
@endforeach
</select>
this is a array select box. i have a add button to add more select boxes so only i kept it as array.
the search option for select is not working in this array of select box.
for the first select box for product its working. when i click the add button and new select box rose means the search option is not working.
whats the problem
Please or to participate in this conversation.