I have a table that contains columns populated from a database. I also have a custom select dropdown in one of the columns, along with an update button. I want to create an event listener for the button that captures the user's selection from the custom select and prints the selected value to the console using JavaScript. Can anyone guide me on how to achieve this?
@foreach ($bookinghalls as $item)
<tr>
<td>{{$item->id}}</td>
<td>{{$item->name}}</td>
<td >{{$item->hall_name}}</td>
<td>{{$item->from_date}}</td>
<td>{{$item->to_date}}</td>
<td>{{$item->type_booking}}</td>
<td ><select class="custom-select mr-sm-2" name="intervel" >
@if ($item->pay==0)
<option value="0" >Not paid</option>
<option value="1" >paid </option>
@else ($item->pay==1)
<option value="1" >paid </option>
<option value="0" >Not paid</option>
@endif
</td>
<td id="stauts"> <?php
if($item->stauts==0)
print_r("available");
elseif($item->stauts==1)
print_r("it's Processing ");
elseif($item->stauts==2)
print_r("booking done");
?></td>
<td><button type="submit" class="btn btn-primary but_update" name="imagaid" >update</button>
</td>