jQuery: The Write Less, Do More JavaScript Library

Problem with IE - Trying to append something to the 'body'

View: New views
5 Messages — Rating Filter:   Alert me  

Problem with IE - Trying to append something to the 'body'

by Vítor-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


I trying to append some text to an html using jquery and it works very
well on FF, Safari and Chrome. On IE 6/8, it did not append even
putting the code inside $(document).ready().

Any ideas?

Cheers!


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/
libs/jquery/1.3/jquery.min.js"</script>
<script>
        $(document).ready(function() {
                $('body').append('Shit!!!');
        });
</script>
</head>
<body>
<form action="form-action.php" method="post" name="f1"
target="myframe" id="f1">
  <input type="text" name="textfield" id="textfield" />
  <input type="submit" name="button" id="button" value="Submit" />
</form>
<iframe name="myframe" src="blank.php"></iframe>
</body>
</html>

Re: Problem with IE - Trying to append something to the 'body'

by Vítor-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Problem solved.

Thanks anyway.

On Oct 4, 11:39 am, Vítor <rotiv...@...> wrote:

> I trying to append some text to an html using jquery and it works very
> well on FF, Safari and Chrome. On IE 6/8, it did not append even
> putting the code inside $(document).ready().
>
> Any ideas?
>
> Cheers!
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml">
> <head>
> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
> <title>Untitled Document</title>
> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/
> libs/jquery/1.3/jquery.min.js"</script>
> <script>
>         $(document).ready(function() {
>                 $('body').append('Shit!!!');
>         });
> </script>
> </head>
> <body>
> <form action="form-action.php" method="post" name="f1"
> target="myframe" id="f1">
>   <input type="text" name="textfield" id="textfield" />
>   <input type="submit" name="button" id="button" value="Submit" />
> </form>
> <iframe name="myframe" src="blank.php"></iframe>
> </body>
> </html>

Re: Problem with IE - Trying to append something to the 'body'

by Bugzilla from jakob.nylin@gmail.com :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

How did you solve it? I have the same problem.

On 4 Okt, 08:30, Vítor <rotiv...@...> wrote:

> Problem solved.
>
> Thanks anyway.
>
> On Oct 4, 11:39 am, Vítor <rotiv...@...> wrote:
>
> > I trying to append some text to an html using jquery and it works very
> > well on FF, Safari and Chrome. On IE 6/8, it did not append even
> > putting the code inside $(document).ready().
>
> > Any ideas?
>
> > Cheers!
>
> > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> > <html xmlns="http://www.w3.org/1999/xhtml">
> > <head>
> > <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
> > <title>Untitled Document</title>
> > <script type="text/javascript" src="http://ajax.googleapis.com/ajax/
> > libs/jquery/1.3/jquery.min.js"</script>
> > <script>
> >         $(document).ready(function() {
> >                 $('body').append('Shit!!!');
> >         });
> > </script>
> > </head>
> > <body>
> > <form action="form-action.php" method="post" name="f1"
> > target="myframe" id="f1">
> >   <input type="text" name="textfield" id="textfield" />
> >   <input type="submit" name="button" id="button" value="Submit" />
> > </form>
> > <iframe name="myframe" src="blank.php"></iframe>
> > </body>
> > </html>

Re: Re: Problem with IE - Trying to append something to the 'body'

by Michael Geary-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Indeed, I'm curious about this too. I've used either $('body').append(...) or $(...).appendTo('body') many times and it's always worked in IE and all other browsers. But now I'm wondering if there is some case I'm overlooking where it might break.

General advice for anyone who posts a question to a mailing list: If you find the answer yourself, *post the answer*. That way other people who run across your post will benefit from it.

Thanks,

-Mike

On Fri, Nov 6, 2009 at 7:35 AM, jnylin <jakob.nylin@...> wrote:
How did you solve it? I have the same problem.

On 4 Okt, 08:30, Vítor <rotiv...@...> wrote:
> Problem solved.
>
> Thanks anyway.
>
> On Oct 4, 11:39 am, Vítor <rotiv...@...> wrote:
>
> > I trying to append some text to an html using jquery and it works very
> > well on FF, Safari and Chrome. On IE 6/8, it did not append even
> > putting the code inside $(document).ready().
>
> > Any ideas?
>
> > Cheers!
>
> > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> > <html xmlns="http://www.w3.org/1999/xhtml">
> > <head>
> > <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
> > <title>Untitled Document</title>
> > <script type="text/javascript" src="http://ajax.googleapis.com/ajax/
> > libs/jquery/1.3/jquery.min.js"</script>
> > <script>
> >         $(document).ready(function() {
> >                 $('body').append('Shit!!!');
> >         });
> > </script>
> > </head>
> > <body>
> > <form action="form-action.php" method="post" name="f1"
> > target="myframe" id="f1">
> >   <input type="text" name="textfield" id="textfield" />
> >   <input type="submit" name="button" id="button" value="Submit" />
> > </form>
> > <iframe name="myframe" src="blank.php"></iframe>
> > </body>
> > </html>


Re: Problem with IE - Trying to append something to the 'body'

by Bugzilla from jakob.nylin@gmail.com :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 6 Nov, 16:51, Michael Geary <m...@...> wrote:
> Indeed, I'm curious about this too. I've used either $('body').append(...)
> or $(...).appendTo('body') many times and it's always worked in IE and all
> other browsers. But now I'm wondering if there is some case I'm overlooking
> where it might break.

Actually I'm new to jQuery, my problem was before I found jQuery. $
('body').append(...) works very well :)


> General advice for anyone who posts a question to a mailing list: If you
> find the answer yourself, *post the answer*. That way other people who run
> across your post will benefit from it.

True!