dimanche 4 juin 2017

Javascript: Can't select my checkbox by Id

I'm working with some checkbox and oneSVG picture. Whant I want to do is when I click on a part of my of my SVG picture Is check or uncheck one of my checkbox.

The click event on my SVG is working but I'm in trouble with my checkboxes.

Each time I'm tryng to do a simple action like a <input onclick="alert(document.getElementById('Checkbox1'));" ;id="Checkbox1" type="checkbox" name="ListPosition" value="ntm" />

> document.GetElementById("Checkbox1");

It always return null

So I tried the following thing :

  window.onload = function () {
            var test = document.getElementById("Checkbox1").checked=true;
            alert(test);
        };

It still return null.

If someone have an idea oh what I'm doing wrong ?




Aucun commentaire:

Enregistrer un commentaire