TypeError: Failed to execute 'createElement' on 'Document':

Hello & TIA ,
Sorry , I can’t figure out what’s wrong :

<!DOCTYPE html>
    <!-- saved from url=(0089)file:///C:/drag-and-drop-ducks-master/Create-Element-P-w3s-document.body.appendChild.html -->
    <html><head><meta http-equiv="Content-Type" content="text/html; charset=windows-1252"></head><body>
    
    <h1>The Document Object</h1>
    <h2>The createElement() Method</h2>
    <p onclick="createElement()" id="notDemo" >Create a p element with some text:</p>
    <p id="demo" onclick="myFunction()">Click me.</p>
    
    <script>
    function myFunction() {
      document.getElementById("demo").innerHTML = "YOU CLICKED ME!";
    }
    </script>
    
    <script>
    function createElement(){
    alert("Entered function createElement(");
    const para = document.createElement("p");
    para.innerText = "This is a paragraph. id="notDemo" ";
    // Append to body:
    document.body.appendChild(para);
    alert("Ran function createElement(");
    }
    </script>
    
    </body></html>

Can you add more details on what you are trying to do? Also, when you run this in your browser, what do the DevTools Console show?

Information below on how to use the console, in case you need it :slight_smile:

Thanks for your reply :
1)
I am trying to create elements that are completely indpendent of other elemenets . This is so that i can dragDrop any element without affecting the movement of other elements.
In this I havent added the drag code yet (see below).
The errors am gettng are:

Create-Element-P-w3s-document.body.appendChild.html:7 Uncaught TypeError: Failed to execute ‘createElement’ on ‘Document’: 1 argument required, but only 0 presen at HTMLParagraphElement.onclick (Create-Element-P-w3s-document.body.appendChi
ld.html:7:44)
zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz

I week ago or so , I posted my 1st try , but got no Repkies .
It’s a Guitar Fretboard’ , with Round-Dots representong finger positioning .
https://vmars.us/Guitar/DragDrop-onDBLclick-RED-add-Table.html
So I deleted it .
The problem with this version is that every time it create a new roun-dot
it repositions all dots down 1 line , there by destroying the fingering positions .
zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
3)
A few days later I chunked it down and posted my 2nd try , but got no Repies . It is a a chunked version of 1) .

So I deleted it .
https://vmars.us/Guitar/Guitar-onDBLclick-RED-add-Table-Need-Help.html
Still the same goal as in 1):
I am trying to create elements that are completely indpendent of other elemenets . This is so that i can dragDrop any element without affecting the movement of other elements.

Please help , Thanks

Sorry for the delay! It’s been a busy few weeks :scroll:

I took a look your example in #3: Clone and Drag Multiple Elements

It worked for me. I didn’t see any errors in the Console. All of the items are also dragging correctly. Did you fix it, or am I missing something subtle? :slight_smile:

Cheers,
Kirupa