
How to get and the set value of text field in JavaScript?

Get the text field value in JavaScript
<html>
<head>
<script type="text/javascript">
<!--
function convertText() {
document.SampleForm.myText.value = document.SampleForm.myText.value.toUpperCase()
}
-->
</script>
</head>
<body>
<form name="SampleForm">
<input type="text" name="myText">
<input type="button" value="Convert" onclick="convertText()">
</form>
</body>
</html>
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.