I am writing a text based game for a college competition and am very new to JS & HTML DOM. I have successfully created an input, and am trying to test it. However, when I type into the input and press enter nothing is logged onto the console...
function new_input(){
let input = document.createElement("INPUT");
input.setAttribute("type", "text");
input.setAttribute("id", "input");
document.body.appendChild(input);
let x = $("input").val();
console.log(x);