자바 스크립트 텍스트 입력 값 가져 오기
var inputValue = document.getElementById("myTextInputID").value;
값 자바 스크립트 가져 오기
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Get Text Input Field Value in JavaScript</title>
</head>
<body>
<input type="text" placeholder="Type something..." id="myInput">
<button type="button" onclick="getInputValue();">Get Value</button>
<script>
function getInputValue(){
// Selecting the input element and get its value
var inputVal = document.getElementById("myInput").value;
// Displaying the value
alert(inputVal);
}
</script>
</body>
</html>
바닐라 자바 스크립트의 텍스트 상자에서 값 가져 오기
document.getElementById("myText").value = "Johnny Bravo";
getelementbyid 의 값
document.getElementById('numbers').value
텍스트 상자 자바 스크립트에서 입력을 얻는 방법
document.getElementById("YourTextBoxId").value
//This code will get the input from a textbox
//Make sure to change "YourTextBoxId" with the id of your textbox