How to get input values while button click in javascript

Manideepgoud
Posted by Manideepgoud under JavaScript category on | Points: 40 | Views : 124
<!DOCTYPE html>
<html>
<head>
<title>Javascript</title>
</head>
<body>
<input type="text" placeholder="Add" id="myvalue"/>
<button type="submit" onclick="myfunction()">Add</button>
<p id="demo"></p><br>
</body>
<script>
function myfunction(){
document.getElementById("demo").innerHTML += document.getElementById("myvalue").value +"<br/>";
}
</script>
</html>

Comments or Responses

Login to post response