Nov 25, 2023
0
Level 1
How to call other value from select option form
i have html like this
<div class="form-group">
<label for="">Kode Objek Pajak</label>
@csrf
<select class="form-control" name="kd_obj" id="kd_obj" required>
<option>Pilih</option>
@foreach ($kd_obj_pjk as $obj_pjk)
<option datauni="{{$obj_pjk->uni}}" value="{{$obj_pjk->kd_obj_pjk}}" required>
{{$obj_pjk->kd_obj_pjk}}|
{{$obj_pjk->nm_obj_pjk}}</option>
@endforeach
</select>
</div>
i try to take the datauni value with this script in jqeury, and it didnt work, any solution guys? sorry im newbie in laravel
function checkValue() {
var inputValue = document.getElementById('nbkp3').value;
var idbill = document.getElementById('idBillPPn');
var unifikasi = document.getElementById('kd_obj').attr('datauni');
if (parseInt(inputValue) >= 2220000 && !isNotificationShown && unifikasi == '1') {
Swal.fire({
title: "Peringatan",
text: "Masukan ID Billing PPN",
icon: "warning"
});
idbill.style.display = 'block';
isNotificationShown = true;
} else if (parseInt(inputValue) < 2220000 && isNotificationShown){
idbill.style.display = 'none';
isNotificationShown = false;
}
}
Please or to participate in this conversation.