Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Jan 2011
    Posts
    42
    Thanks
    1
    Thanked 0 Times in 0 Posts

    IE JS Error when setting innerhtml

    Hi,

    I'm getting JS error while setting innerHTML for td tag.

    I'm seeing this error only in IE.

    Can any one please let me know on how i can resolve this.

  • #2
    Senior Coder
    Join Date
    Apr 2011
    Location
    London, England
    Posts
    2,120
    Thanks
    15
    Thanked 354 Times in 353 Posts
    Apparently IE struggles when using innerHTML to amend tables.

    Are you just putting some text into the cell? Then you could perhaps make use of this function:
    Code:
    function changeText(elem,changeVal){
       if(elem.textContent){
          elem.textContent = changeVal;    // FF
       }else{
          elem.innerText = changeVal;    // IE
       }
    }
    "I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
    Validate your HTML and CSS


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •