galvin Posted May 12, 2009 Share Posted May 12, 2009 This might not be answerable without seeing ALL of my code, but just curious if anyone is aware of why in FireFox, innerHTML inserts into Table Data cells cause the Table Data cells to shift from where they should be. I have a basic TR like below, where it's five TDs across ONE TR.... <tr> <td class="answer" id="answer0"> </td> <td class="answer" id="answer1"> </td> <td class="answer" id="answer2"> </td> <td class="answer" id="answer3"> </td> <td class="answer" id="answer4"> </td> </tr> In IE, it stays this way just fine, after I use innerHTML inserts. But in FireFox, I fill in say, the 2nd Data cell using innerHTML and it appears fine. Then I fill in the 1st Data cell using innerHTML and it appears fine, but the 2nd Data Cell moves and relocates UNDER the 1st Data Cell. In other words, it moves to another TR that was NEVER THERE TO BEGIN WITH. As an example, after I enter do some innerHTMLs in IE, the table structure stays exactly the same as it started (see above code). But in Firefox, my ultimate Table has this type of wacked-out structure... <tr> <td class="answer" id="answer0">text</td> <td class="answer" id="answer3">text</td> </tr> <tr> <td class="answer" id="answer1">text</td> <td class="answer" id="answer2">text</td> <td class="answer" id="answer4">text</td> </tr> I am going nuts trying to figure this out. Any thoughts of what could cause this? Quote Link to comment https://forums.phpfreaks.com/topic/157763-firefox-table-data-cells-shifting-using-innerhtml/ Share on other sites More sharing options...
galvin Posted May 12, 2009 Author Share Posted May 12, 2009 Just found this on Google.... Problem: IE supports innerHTML for table cells and FireFox doesn’t. Solution: You have to embed a div within the table cell and perform all innerHTML calls on that. This actually works, but that seems ridiculous to have to put a DIV inside every TD. Unless anyone has any thoughts other thoughts, I guess that's what I'll have to do. Quote Link to comment https://forums.phpfreaks.com/topic/157763-firefox-table-data-cells-shifting-using-innerhtml/#findComment-832138 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.