Cannot create a div tag using document.createElement('div'); In JavaScript

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title> </title>
     <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js" >
     </script>
  </head>
  <body>
    <input type="button" name="add" value="ADD DIV" onclick="addRow();"/>
    <p id="content">

    </p>
    

<script type="text/javascript">
      function addRow(){
       var div=document.createElement('div');
       div.className='row';
       console.log(document.getElementById('content'));
       console.log("CRETING DIV"+div);
       div.innerHTML = ` <input type="text" name="name" value="" />
                         <input type="text" name="value" value="" />
                        <label>
                          <input type="checkbox" name="check" value="1" /> Checked?
                        </label>
                         <input type="button" value="-" onclick="removeRow(this)" /> `;
                    console.log("after creting the  DIV "+div);
             document.getElementById('content').appendChild('div');
      }
     </script>
  </body>
</html>

THE PROBELM:

when I am using the create element to create the DIV tag, it does not create the tag rather shows in the console [object HTMLDivElement]

Also, the appendChild(‘div’) does not work.it says
RemoveDIVtagUsingJS.php:27 Uncaught TypeError: Failed to execute ‘appendChild’ on ‘Node’: parameter 1 is not of type ‘Node’

I don’t know why my document.createElement(‘div’); is not working.What to do?

41 thoughts on “Cannot create a div tag using document.createElement('div'); In JavaScript”

  1. Pingback: cialis canada