JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<div class="cbb">
<select class="form-control select2 firstname v1 select2-hidden-accessible" id="name1_148" name="name[]" style="width: 100%;" data-select2-id="name1_148" tabindex="-1" aria-hidden="true">
<option value="-1" selected="" disabled="" data-select2-id="299">Please Select Name</option><option value="1">K-76</option><option value="2">Af</option><option value="3">A-c</option>/option><option value="4">D-B</option><option value="5">329</option><option value="6">F-g</option><option value="7">AT</option></select>
<select class="form-control select2 firstname v1 select2-hidden-accessible" id="name1_149" name="name[]" style="width: 100%;" data-select2-id="name1_148" tabindex="-1" aria-hidden="true">
<option value="-1" selected="" disabled="" data-select2-id="299">Please Select Name</option><option value="1">K-76</option><option value="2">Af</option><option value="3">A-c</option>/option><option value="4">D-B</option><option value="5">329</option><option value="6">F-g</option><option value="7">AT</option></select><select class="form-control select2 firstname v1 select2-hidden-accessible" id="name1_149" name="name[]" style="width: 100%;" data-select2-id="name1_148" tabindex="-1" aria-hidden="true">
<option value="-1" selected="" disabled="" data-select2-id="299">Please Select Name</option><option value="1">K-76</option><option value="2">Af</option><option value="3">A-c</option>/option><option value="4">D-B</option><option value="5">329</option><option value="6">F-g</option><option value="7">AT</option></select>
...
JavaScript
$( ".firstname").on('change',function() {
$(".firstname option").prop("disabled", false); //enable everything
//collect the values from selected;
var arr = $.map(
$(".firstname option:selected"), function (n) {
return n.value;
}
);
//disable elements
$(".firstname option").filter(function () {
return $.inArray($(this).val(), arr) > -1; //if value is in the array of selected values
}).prop("disabled", true);
//re-enable elements
$(".firstname option").filter(function () {
return $.inArray($(this).val(), arr) == -1; //if value is not in the array of selected values
}).prop("disabled",false);
$(this).prop('disabled',false);//re-enable the current one //1
$(this).show();//and show it //1
$(this).prop('selected',true);//just to be sure re-select the option afterwards //1
});
$('.savebtn').on('click', function(){
$('.cbb').each(function(index, item){
var selectVal = $(this).find('select').val();
console.log(selectVal);
});
});