There is an array of data from the database, which I will iterate
foreach ($arr as $key => $value) { <select class="active" name="active"> <option><?=$value['active']?></option> <option class="sec_act"></option> </select> } It turns out one option empty, and the other has either active or noactive How can I use js to .active over the .active and fill in the empty option , where there is already an active one, add noactive and vice versa?
I had about such an attempt:
$('.active').each(function(){ if($(this).val() == 'active'){ $(this).closest('.sec_act').html('noactive'); }else{ $(this).closest('.sec_act').html('active'); } });
$(".className")- nick_n_a