Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Banned
    Join Date
    Aug 2007
    Posts
    39
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Exclamation Get value of input field and set as variable

    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!

  • #2
    Regular Coder
    Join Date
    Mar 2006
    Posts
    726
    Thanks
    35
    Thanked 132 Times in 123 Posts
    var email = document.getElementById('email').value;
    or if you have only one element named 'email':
    var email = document.getElementsByName('email')[0].value;


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •