• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

InnerHTML getElementByID issue.

 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
echarish Kumar
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic