aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes why document.getElementById work with form elements Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply locked New topic
Author

why document.getElementById work with form elements

Rajesh Khan
Ranch Hand

Joined: Oct 16, 2011
Posts: 230
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

Joined: Jan 10, 2002
Posts: 61766
    
  67

Of course it works with form elements. It works with any element in the DOM.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Rajesh Khan
Ranch Hand

Joined: Oct 16, 2011
Posts: 230
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

Joined: Jan 10, 2002
Posts: 61766
    
  67

Looks like this is the same issue as your other post. Let's continue any further discussion there.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: why document.getElementById work with form elements