Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9298175
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T22:15:26+00:00 2026-06-18T22:15:26+00:00

I have some code that works in IE7 and 8 but not in 9

  • 0

I have some code that works in IE7 and 8 but not in 9

var table = document.getElementById('RadGrid_ctl01').childNodes[2];

which doesn’t work in IE9, now I did read that IE9 count white spaces etc and therefore the index won’t be the same as in IE7 and IE8 so I debugged and found same values when I changed index from 2 to 4 like so:

var table = document.getElementById('RadGrid_ctl01').childNodes[4];

However when I later on try to access the table object with this code

var editor = table.childNodes[i].childNodes[j].childeNodes[0]

the variable editor will get the expected value in IE7 and IE8, but in IE9 it becomes null since the childNodes[j] doesn’t have any children. I have no idea what causes this.
both i and j starts at 0.

Anyone know what I am doing wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T22:15:27+00:00Added an answer on June 18, 2026 at 10:15 pm

    The behaviour of IE9 is right, lower versions are wrong.
    The problem is caused by whitespace between two html-tags, which should lead into text-nodes.

    UPDATE: Added example

    <ul><li>Foo</li><li>Bar</li></ul>
    
    <ul>
        <li>Foo</li>
        <li>Bar</li>
    </ul>
    

    Looks pretty much the same, doesn’t it? However the resulting DOM differs.
    First example would result in:

    - ul
    -- li
    --- (text)Foo
    -- li
    ---(text)Bar
    

    While the second Markup leads into this:

    - ul
    -- (text)
    -- li
    --- (text)Foo
    -- (text)
    -- li
    --- (text)Bar
    -- (text)
    

    And since text-nodes cannot have any child-nodes, this causes your Javascript to fail silently.

    Possible solution

    One solution is to strip out the empty text-nodes. I once wrote a gist for this issue.

    UPDATE:

    Node.normalize() seems to be a more reliable solution, but i didn’t check it for browser-compatibilty.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some code that works fine in FF but not in IE. I
I have some login code that works well for Firefox and other browsers, but
I have some very basic semaphore code that works great on Linux, but cannot
i have some javascript roll over code that works fine in firefox but when
I have some JavaScript code that works in IE containing the following: myElement.innerText =
I have some toy code for a tooltip. It works okay, except that when
I'm using jQuery 1.6.1 and I have some code that's erroring out in IE7,
Hello stackoverflow community, I have some code that works on virtually every browser except
I have some older code that doesn't appear to work on 64bit Windows 7.
I have the following piece of code that takes in some words, stores them

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.