• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 749
  • Last Modified:

How do I move the values of an ASP.Net Hidden Field to an Html input text box with JavaScript?

How do I move the values of an ASP.Net Hidden Field to an Html input text box with JavaScript?

I have return values from a db that i put into a HiddenField control, and on button click event I would like to display it in an html input text box.  not and asp.net textbox.

Thanks
0
bmanmike39
Asked:
bmanmike39
  • 2
1 Solution
 
Dave BaldwinFixer of ProblemsCommented:
You have to make sure that both fields have 'id's.  Then you can do this:
<script type="text/javascript">
document.getElementById('TextField').value = document.getElementById('HiddenField').value;
</script>

Open in new window

0
 
Scott Fell, EE MVEDeveloperCommented:
If you use jquery

<script>
$(function()({
var foo=$('#test123').val();
$('#use_me').val(foo);
});
</script>
<input type="hidden" id="test123" value="hello">
<input id="from_test123" name="something">

Open in new window

0
 
bmanmike39Author Commented:
Thanks!!
0
 
Dave BaldwinFixer of ProblemsCommented:
You're welcome!
0

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now