JavaScript Run Function by Click on button

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<!DOCTYPE html>
<html>
<head>
	<title>Test</title>
	<meta charset="UTF-8">

    <script src="script.js"></script>

</head>
<body>
	<h1>Hello!</h1>

    <input id="clickMe" type="button" value="Загрузить PDF" onclick="myFunc();" />

</body>
</html>


script.js


1
2
3
var myFunc = function(){
console.log('Click');
}