0

I get this error:

Uncaught SyntaxError: Unexpected end of input

I don't know what I am missing

<input class="myButton" type="button" name="slaapkamer1aan" value="AAN" onclick="slaapkameron("slaapkamer1")">

var kamer = document.getElementById(x);
            if (kamer.src.match("lichtUit.png")) {
                kamer.src = "lichtAan.png";
            }
            else {
                kamer.src = "lichtAan.png";
            }

        <?php slaapkameraan();?>
}

any ideas?

3
  • 1
    onclick="slaapkameron("slaapkamer1")" read it three times and you will probably know by yourself. Commented Feb 24, 2022 at 20:11
  • 1
    Also you have an extra } - also you do know that your onclick="slaapkameron(... is not going to trigger your PHP ` <?php slaapkameraan();?>`? Commented Feb 24, 2022 at 20:12
  • The attribute onclick="slaapkameron(" does not contain valid JavaScript. Inline event handlers like onclick are bad practice. They’re an obsolete, cumbersome, and unintuitive way to listen for events. Always use addEventListener instead. Commented Feb 24, 2022 at 20:22

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.