you might not need jquery to accomplish that, try: document.body.innerHTML += YOUR_VAR;
On Nov 3, 11:34 am, "John Resig" <[EMAIL PROTECTED]> wrote: > We'll need to see a page to know what's going on - that code, alone, > shouldn't cause problems. > > --John > > On 11/3/07, ja <[EMAIL PROTECTED]> wrote: > > > > > I'm dynamically inserting html into a page that only contains an > > image. Such as... > > <html> > > <body> > > <img src="http://my_domain.com/my_image.jpg"/> > > </body> > > </html> > > > my script has a large amount of html that i want to insert. the html > > is stored in a variable . Such as.. > > var my_var = "<div>HI</div>"; > > (the actual html is much larger and more complicated than my example) > > > I then have.. > > $('body').append(my_var); > > > which you would think would insert the html into the page. it doesn't, > > instead it just inserts it as text. The source in Firebug is now... > > <html> > > <body> > > <img src="http://my_domain.com/my_image.jpg"/> > > <DIV><div>HI</div> > > </body> > > </html> > > > NOTE: that extra div that's all CAPS, isn't a typo. jquery inserts > > that for some reason and I don't know why. > > The page doesn't render the "<div>HI</div>" as html, it displays it as > > plain text. > > If I use the same code on a page that has some more to it, like > > google's homepage, the extra "<DIV>" isn't there and my html gets > > inserted properly (not as text). > > > any clues as to why? is this a bug? am I missing some aspect of web > > pages when they are only images? > > Thanks in advanced for your help. > > Josh