SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: ID returns null

  1. #1
    SitePoint Zealot
    Join Date
    Dec 2010
    Posts
    167
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    ID returns null

    Why does firebug tell me that key_field is undefined? Is it because I haven't defined it in the HTML?

    key_input.setAttribute('id', 'companykey');
    var key_field = document.getElementById('companykey');

  2. #2
    SitePoint Member
    Join Date
    Apr 2011
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    As long as key_input is a DOM element, that code should work fine. Can you provide a little bit more?

  3. #3
    SitePoint Zealot
    Join Date
    Dec 2010
    Posts
    167
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by overthemike View Post
    As long as key_input is a DOM element, that code should work fine. Can you provide a little bit more?
    I got it working. Thanks.


Bookmarks

Posting Permissions

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