How can dynamically remove element of form by Javascript?
<p>I make a form with dynamic elements with Javascript.
I can add elements, but how can I remove them from form?
I can't solve problem. I'm confused! :(</p>
<p>My Code:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script type="text/javascript"&gt;
//+Element
function addElement(div) {
  var ni = document.getElementById(div);
  var numi = document.getElementById('numVal');
  var num = (document.getElementById('numVal').value -1)+ 2;
  numi.value = num;
  var newdiv = document.createElement('div');
  newdiv.setAttribute('id',num);
  var unum="'"+div+"','"+num+"'";
  newdiv.innerHTML ='&lt;input id="t" type="tel" placeholder="Tel.'+num+'" name="t'+num+1+'"&gt;&lt;img id="del" onClick="removeElement('+unum+');" alt="del" src="images/del.gif" /&gt;';
  ni.appendChild(newdiv);
}
//-Element
function removeElement(divNum,div) {
  var d = document.getElementById(div);
  var olddiv = document.getElementById(divNum);
  d.removeChild(olddiv);
}
&lt;/script&gt;

    &lt;form&gt;
    &lt;input type="hidden" value="0" id="numVal" /&gt;
    &lt;div id="m"&gt;
        &lt;div id="h125"&gt;
            &lt;div class="fb"&gt;
                &lt;input id="t" type="tel" placeholder="Tel."&gt;
                &lt;img id="add" Alt="add" src="images/add.gif" onclick="addElement('h125');" /&gt;
            &lt;/div&gt;
        &lt;/div&gt;
    &lt;/div&gt;
    &lt;/form&gt;</code></pre>
</div>
</div>
</p>