Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to get text from input js

// to get value from text input (or textarea):
// in html:
<input class="my-class">type something here with console opened</input>
// in js:
const myInputArea = document.querySelector(".my-class")
myInputArea.addEventListener("input", (e)=>{
  const myInputText = e.target.value
  console.log(myInputText)
})
 
PREVIOUS NEXT
Tagged: #text #input #js
ADD COMMENT
Topic
Name
7+2 =