Hi

    var div = document.createElement('div');
            div.id = 'window';

        var div2 = document.createElement('div');
            div2.id = 'windowhead';

        var span1 = document.createElement('span');
            span1.id = 'name';
        div2.appendChild(span1);

        var div3 = document.createElement('div');
            div3.id = ('close');

        div2.appendChild('div3');
        div.appendChild(div2);
        document.body.appendChild(div);

Can someone tell me why chorme console is giving me this error :
Uncaught TypeError: Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'.

Recommended Answers

All 2 Replies

Member Avatar for stbuchok

why is div3 a string on line 14?

ok done but code isn't working how i want, here is my code it should a little bit work like this.
problem: i want to click someone's name, and his/her name should appear in windowhead
i am trying to create facebook chatwindow type

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.