Take value or string form textbox and show it in alert using Javascript

Javascript / Overview of Javascript

232

Program:

<input type="text" id="demo">
<input type="button" onclick="msg(document.getElementById('demo').value)" value="call function"/> 

<script> 

function msg(a){  
	alert("Value from Textbox: "+a+"");  
}  

</script>

Output:

Copy above code and run it

Explanation:

When you will put any value in the textbox it will show in alert

This Particular section is dedicated to Programs only. If you want learn more about Javascript. Then you can visit below links to get more depth on this subject.