This dead simple stub of a web page will execute the translate()
function in onload
but not in the button's onclick
. It instead throws "Uncaught TypeError: translate is not a function".
What simple mistake am I making?
function createSvgDef() {
console.log("createSvgDef()");
}
function translate() {
console.log("translate()");
}
<html>
<head>
<link rel="stylesheet" href="this-thing.css"/>
<script type="text/javascript" src="this-thing.js"></script>
</head>
<body onload="createSvgDef(); translate();">
<textarea id="input">Hello World!</textarea>
<button onclick="translate();">Translate</button>
<div id="output"></div>
</body>
</html>