Saved X
Google login
SignUp with Email
X

How to get a user input in js

theindreshverma ( Added  Sep 29, 06:37 pm )
Login

Javascript element.value method

<html>
<head>
    <title>get a user input in js</title>
</head>
<body>

<h1>get a user input in js</h1>

<input type="" id="in" placeholder="Enter here" /><br><br>

<button onclick="getInput()">Get value</button>

<scriprt>
function getInput() {
    var x = document.getElementById('in');
    
    alert(x.value);
}
</scriprt>

</body>
</html>

Sourcecode Tags

More Sourcecodes

More Sourcecodes