Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
    Bookmark Topic Watch Topic
  • New Topic

why document.getElementById work with form elements

 
Rajesh Khan
Ranch Hand
Posts: 230
  • Mark post as helpful
  • send pies
  • Report post to moderator
I wanted to know if document.getElementById works while accessing form elements.
I tried doing this just for testing purposes

This code doesnt work


but this does


Why doesnt document.getElementByid work with form objects.it works with all non form HTML objects..
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65105
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
Of course it works with form elements. It works with any element in the DOM.
 
Rajesh Khan
Ranch Hand
Posts: 230
  • Mark post as helpful
  • send pies
  • Report post to moderator
Bear Bibeault wrote:Of course it works with form elements. It works with any element in the DOM.


Hmm.. could you suggest what I might be doing wrong here ??



and the function is
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65105
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
Looks like this is the same issue as your other post. Let's continue any further discussion there.
 
    Bookmark Topic Watch Topic
  • New Topic