title: How to Delete the Textbox dynamically in a DIV using javascript
body: <p>How to Delete the TextBox in a DIV using javascript. First I created the four column in a div and I created the checkbox dynamically using the Add button in a div.</p>
  
  <p>What is my problem is I need to delete the appropriate textbox using the Delete button (behind the textbox).</p>
  
  <p>So please give me a solution to rectify it. </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function Add() {
    div1.innerHTML += "&lt;br&gt;&lt;br&gt; &lt;input type='text' name='mytext'&gt;" + "&lt;input type='button' value='Delete' onclick='removeRow(this)'&gt;";
    div2.innerHTML += "&lt;br&gt;&lt;br&gt; &lt;input type='text' name='mytext'&gt;" + "&lt;input type='button' value='Delete' onclick='removeRow(this)'&gt;";
    div3.innerHTML += "&lt;br&gt;&lt;br&gt; &lt;input type='text' name='mytext'&gt;" + "&lt;input type='button' value='Delete' onclick='removeRow(this)'&gt;";
    div4.innerHTML += "&lt;br&gt;&lt;br&gt; &lt;input type='text' name='mytext'&gt;" + "&lt;input type='button' value='Delete' onclick='removeRow(this)'&gt;";
  }
  
  function removeRow(input) {
    document.getElementById('div1').removeChild(input.parentNode);
  }</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>#Wrapper {
    width: 90%;
    margin: 0 auto;
  }
  #div1 {
    float: left;
    width: 20%;
    background: lightblue;
  }
  #div2 {
    float: left;
    width: 20%;
    background: lightyellow;
  }
  #div3 {
    float: left;
    width: 20%;
    background: lightgray;
  }
  #div4 {
    float: left;
    width: 20%;
    background: lightblue;
  }
  #ClearFix {
    clear: both;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;button onclick="Add()"&gt;Add TextBox&lt;/button&gt;
  &lt;div id="Wrapper"&gt;
    &lt;div id="div1"&gt;
      &lt;p&gt;This is Div one&lt;/p&gt;
    &lt;/div&gt;
  
    &lt;div id="div2"&gt;
      &lt;p&gt;This is Div two&lt;/p&gt;
    &lt;/div&gt;
  
    &lt;div id="div3"&gt;
      &lt;p&gt;This is Div threee&lt;/p&gt;
    &lt;/div&gt;
  
    &lt;div id="div4"&gt;
      &lt;p&gt;This is Div Four&lt;/p&gt;
    &lt;/div&gt;
  
    &lt;div id="ClearFix"&gt;&lt;/div&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>