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?

t.niese
  • 39,256
  • 9
  • 74
  • 101
  • 1
    `onclick="slaapkameron("slaapkamer1")"` read it three times and you will probably know by yourself. – technophyle Feb 24 '22 at 20:11
  • 1
    Also you have an extra `}` - also you do know that your `onclick="slaapkameron(...` is not going to trigger your PHP ` `? – Kinglish Feb 24 '22 at 20:12
  • The attribute `onclick="slaapkameron("` does not contain valid JavaScript. Inline event handlers like `onclick` are [bad practice](/q/11737873/4642212). They’re an [obsolete, cumbersome, and unintuitive](/a/43459991/4642212) way to listen for events. Always [use `addEventListener`](//developer.mozilla.org/docs/Learn/JavaScript/Building_blocks/Events#inline_event_handlers_%E2%80%94_dont_use_these) instead. – Sebastian Simon Feb 24 '22 at 20:22

0 Answers0