my dog learned polymorphism
The moose likes HTML, CSS and JavaScript and the fly likes InnerHTML getElementByID issue. Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply Bookmark "InnerHTML getElementByID issue." Watch "InnerHTML getElementByID issue." New topic
Author

InnerHTML getElementByID issue.

echarish Kumar
Ranch Hand

Joined: Feb 02, 2010
Posts: 42
Hi

I have created a span (id=mySpan) tag in my index.html and than later with the help of getElementById("mySpan").innerHTML I have set the UI List (id:menuList) in my span. Now in my other script on the index page i want to access this menuList object, but when i am doing getElementById("menuList") on index page i am gettting NULL.

Can anyone please help how should i proceeed to solve this problem or what i am doing wrong with it.

my menuList is a seprate HTML which is a header of my page and i am including it with the help of AJAX request in my index.html.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56191
    
  13

Here's where you lost me:
echarish Kumar wrote:my menuList is a seprate HTML

What do you mean by "separate [sic] HTML"? You're not trying to inject an entire HTML page inside the DOM, are you?


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
echarish Kumar
Ranch Hand

Joined: Feb 02, 2010
Posts: 42
Hi..

Thanks for replying ...
Iam able to close the problem, i was trying to get the element object even before it was created with the innerHTML so i was getting the null. thanks again.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: InnerHTML getElementByID issue.
 
Similar Threads
Dynamic display of messages (using innerHTML?) in IE, FF and other browsers
Could not find action or result
Updating content with javascript
Problem in retrieving List from class and displaying it in JSP in struts2
to pass the id into javascript