0

This works:

<html>
    <script type="text/javascript">
        function lala() {
            console.log("lala");
        }
    </script>
    <body>
        <button onclick="lala()">lala</button>
    </body>
</html>

But having that in jsfiddle works not:

<button onclick="lala()">lala</button>

function lala() {
    console.log("lala");
}

https://jsfiddle.net/clankill3r/715kha38/

Uncaught ReferenceError: lala is not defined

I saw some old answers on stackoverflow regarding this problem but those seem to be invalid those days.

clankill3r
  • 9,146
  • 20
  • 70
  • 126

1 Answers1

0

Please change Load type in java script section select

No wrap - in <head>
Kapil
  • 1,143
  • 13
  • 25