I have the code:
<script>
var elements = document.getElementsByName("customSwitch1");
for (let i = 0; i < elements.length; i++) {
var checkBox = elements[i].getAttribute('id');
checkBox.addEventListener('click', function (e) {
$('#form1').submit();
});
}
</script>
Why this code call the error Uncaught TypeError: checkBox.addEventListener is not a function
Aucun commentaire:
Enregistrer un commentaire