[Javascript] innerHTML misplacing text

Noah Sussman noah at onemorebug.com
Mon Aug 27 16:48:42 CDT 2007


On 8/27/07, lists at jdpill.com <lists at jdpill.com> wrote:
> I have an oddity (possibly due to my lack of familiarity with javascript)...
>
> I'm trying to drop some html into a DIV, and while the text *is* being
> placed in the html file, it is being put in the wrong place.

As written, your code places a table cell inside a div.  If you view
the rendered source of your page (using Firebug or IE Web Developer
Toolbar, for instance) you will likely see that you have this:

   <tr>
     <div id="existingSiteOption"><td>Hello World!</td></div>
   </tr>

Which isn't valid HTML (because you have a DIV inside a TR but not
inside a TD, and nested inside that is a TD whose parent is not a TR.

Fixing that may fix your layout problem.


-- 
Noah Sussman
Noah_|___OneMoreBug.com

"the lyfe so short, the craft so long to lerne"  --Chaucer



More information about the Javascript mailing list