If you look up the documentation of jQuery for text, you'll see that text() manipulates text nodes (or text node content). If you're setting a value on a textbox you should be using the val() function.
var text = "hello"
$('#id').val(text);
//where id is the id assigned to your text box
//eg.
<input type='text' id='mytextbox' value=''/>
//it should be then
var text = "hello"
$('#mytextbox').val(text);