Reputation: 22041
Is there anyway I can get the value of a text field without posting a form. I would like to use the value somewhere else in the same page.
Upvotes: 0
Views: 1382
Reputation: 171
var t=document.getElementById('textField').value;
alert(t);
Upvotes: 0
Reputation: 359906
The answer is to use some sort of client-side scripting.
With plain old Javascript, if your text field has ID 'textField':
document.getElementById('textField').value;
Or with jQuery:
$('#textField').text();
Upvotes: 3
Reputation: 14426
You can call a javascript function on any events (By example when your text field loose focus) and get the text field value by using the value
property.
Upvotes: 0
Reputation: 8158
You can use JavaScript. textarea
elements have a value
property that holds whatever text is in them.
Upvotes: 1