Try this:
    $(document).ready(function(){
        $("#foobar").append("<div />");
      });

On Jul 29, 4:51 pm, Wulf <wulf1...@googlemail.com> wrote:
> Hey there,
> I read a lot of things now about creating elements with $("<div/>")
> and the appendTo method.
> here is my code I'm trying to get to work:
> <html>
>   <head>
>     <title>Foobar</title>
>     <script type="text/javascript" src="js/jquery.js"></script>
>     <script type="text/javascript">
>       $(document).ready(function(){
>         $("<div/>").appendTo("#foobar");
>       });
>     </script>
>   </head>
>   <body>
>     <div class="main">
>       <div id="foobar">
>       </div>
>     </div>
>   </body>
> </html>
> I'm using jquery 1.3.2 and Firefox 3.5.1 together with Firebug, which
> tells me "Node cannot be inserted at the specified point in the
> hierarchy" code: "3".
>
> Can you tell me what I'm doing wrong? Thank you very much.
>
> Wulf

Reply via email to