dimanche 12 juin 2022

Set Checkbox to Checked with JavaScript window.onload and make persistent page refresh or click event

reference: Set Checkbox to Checked with JavaScript after page Load

I have following code

    window.onload = function() {
    document.getElementById("gui-form-newsletter").checked = true;
    }

What I notice that after onload when a some other radio button events are clicked the checked state on checkbox disappears. How can I prevent this?




Aucun commentaire:

Enregistrer un commentaire