Error in addEventListener?

Good day, I will describe the problem, doing a task on the translation of the values( done in jsfiddle in other words the sandbox code)
then the same code pasted in vs code but it does not work, throws the error , but not the vs code and in the browser if you look at the error. Knowledgeable look at the code, if possible not in the sandbox and downloading to your PC, would be very grateful and karma will return to you doubly.

PS the Code below
<!DOCTYPE html>
<html>
the <head>
 <meta charset="UTF-8">
 <meta name="viewport" content="width=device-width, initial-scale=1.0">
 <meta http-equiv="X-UA-Compatible" content="ie=edge">
 <link rel="stylesheet" href="style.css">
 <script src="script.js"></script>
<title>Document</title>
</head>
the <body>
 <input type="text" name="" id="" class="void">
 <button class="butt">Click</button>
</body>
</html>


let inp = document.querySelector('.void');
let x = document.querySelector('.butt');
butt.addEventListener("click", change);
function change() {
 let myObj = {};
 var str = inp.value;
 if(str.indexOf("C") != -1){
 myObj.K = Number.parseInt(str) +273;
 myObj.F = Number.parseInt(str) * (9/5) + 32;
 alert( JSON.stringify(myObj))
 } else {
 if(str.indexOf("K") != -1){
 myObj.C = Number.parseInt(str) -273;
 myObj.F = (Number.parseInt(str) -273) * (9/5) + 32;
alert(JSON.stringify(myObj))
 } if(str.indexOf("F") != -1) {
 myObj.C = (Number.parseInt(str) - 32) * (5/9);
 myObj.K = (Number.parseInt(str) - 32) * (5/9) + 273;
alert(JSON.stringify(myObj))
 } else {
 alert ("You dont write "success " mesage")
}
}
}
March 20th 20 at 11:47
1 answer
March 20th 20 at 11:49
Solution
Again, the error text have to guess? Well here my telepathy enough to even run is not necessary.
The connected script in the header, it looks for elements which are not yet on the page.
Doesn't find them.
Kapets.
Yes) you're right, thank you very much)) I will try in the future is more clear to write) - Mozell78 commented on March 20th 20 at 11:52

Find more questions by tags JavaScript