I have the following HTML and TS code and I get the following error. I am trying to fix it but without any further progress. Could you please help me? I am new to TS and web-development. Error: Property 'value' does not exist on type 'Element'
// TS CODE
const elInput = document.querySelector(`#chat-form-input`)
// add onkeypress listener
document.onkeypress = function (e) {
// use e.keyCode
if (e.key === 'Enter') {
// code for enter
console.log(elInput)
console.log(elInput.value) //error
}
}
<body>
<div id="chat-container">
<div id="search-container">
<input type="text" placeholder="search"/>
</div>
<div id="conversation-list">
</div>
<div id="new-message-container">
<a href="#" id="test">+</a>
</div>
<div id="chat-title">
</div>
<div id="chat-message-title">
</div>
<div id="chat-form-container">
<input id="chat-form-input" type="text" placeholder="Type a message!"/>
</div>
</div>
</body>