vendredi 22 mars 2019

Javascript Validate

I have a checkbox that I want to verify the checkbox (same names with different values) and to enable/disable if value is an E and it is checked.

function DisableETP() {
 var kk = document.getElementsByName('RQR')
 for (var i = 0; i < kk.length i++) {
    if (kk[i].value == 'E' and kk[i].checked == true) {
 document.getElementById('cp2').disabled = true
 document.getElementById('cp2').value = ""
 document.getElementById('rtp2').disabled = true
 document.getElementById('rtp2').value = ""
 document.getElementById('qty2').disabled = true
 document.getElementById('qty2').value = ""
 document.getElementById('cp3').disabled = true
 document.getElementById('cp3').value = ""
 document.getElementById('rtp3').disabled = true
 document.getElementById('rtp3').value = ""
 document.getElementById('qty3').disabled = true
 document.getElementById('qty3').value = ""
    } else {
 document.getElementById('cp2').disabled = false
 document.getElementById('cp2').value = ""
 document.getElementById('rtp2').disabled = false
 document.getElementById('rtp2').value = ""
 document.getElementById('qty2').disabled = false
 document.getElementById('qty2').value = ""
 document.getElementById('cp3').disabled = false
 document.getElementById('cp3').value = ""
 document.getElementById('rtp3').disabled = false
 document.getElementById('rtp3').value = ""
 document.getElementById('qty3').disabled = false
 document.getElementById('qty3').value = "" }
 }

Do I need to add ; to the lines or ???

Thank you.




Aucun commentaire:

Enregistrer un commentaire