...

View Full Version : Get value of input field and set as variable



I_Love_Privacy
12-24-2008, 03:12 AM
Hello, I'm trying to grab the value of an input form, and set it as a variable..
Here is the text field
<input name="email" id="email" type="text" size="35" value="email@email.com"/>

I'm not sure on how to do this
email = win.document.getElementById('email');

Would that be correct?

Thanks in advance!

mrhoo
12-24-2008, 03:42 AM
var email = document.getElementById('email').value;
or if you have only one element named 'email':
var email = document.getElementsByName('email')[0].value;



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum