title: Delete row from table dynamically created in javaScript
body: <p>I want to delete a row from a table created by JavaScript. i tried the code from different post on this page but doesn't solve it. </p>
  
  <pre><code>function value_pass()
    {
  var Delete =  document.createElement("input");
                  Delete.type="button";
                  Delete.name = "del"
                  Delete.value = "Delete";
                  Delete.onclick = function(o)
                  {
                        var r = o.parentElement.parentElement;                                          
                        document.getElementById("table").deleteRow(r.rowIndex);
                 }
  
  var order_no = document.getElementById("Order_no");
  var quantity = document.getElementById("quantity");
  var type = document.getElementById("Recipe");
  var recipe = type.options[type.selectedIndex].text;
  
  var body1 = document.getElementsByTagName("body")[0];
  var tbl = document.createElement("table");
  tbl.setAttribute("id","table");
  var tblbody = document.createElement("tbody");
  tbl.setAttribute("border","2");
  
  var col = document.createElement("td");
  
  for (var j = 0; j &lt; 1; j++) 
  {
      var rows = document.createElement("tr");
      for (var i = 0; i &lt; 4; i++)
      {
          var col1 = document.createElement("td");
          var col2 = document.createElement("td");
          var col3 = document.createElement("td");
          var col4 = document.createElement("td");
          var col5 = document.createElement("td");
  
          var col1text = document.createTextNode(order_no.value);
          var col2text = document.createTextNode(recipe);
          var col3text = document.createTextNode(quantity.value);
          var col4text = document.createTextNode();
  
              //also want to put checked values in table row
  
  
      }
      col1.setAttribute("width","150");
      col2.setAttribute("width","150");
      col3.setAttribute("width","150");
      col4.setAttribute("width","150");
  
  
      col1.appendChild(col1text);
      col2.appendChild(col2text);
      col3.appendChild(col3text);
      col4.appendChild(col4text);
      col5.appendChild(Delete);
  
      rows.appendChild(col1);
      rows.appendChild(col2);
      rows.appendChild(col3);
      rows.appendChild(col4);
      rows.appendChild(col5);
  
      tblbody.appendChild(rows);
  } tbl.appendChild(tblbody);
  body1.appendChild(tbl);
  }
  </code></pre>
  
  <p>The function will be called by a button in <code>HTML</code>
  its an order form that</p>
  
  <p>and also want to know about the checked values of checkbox to put in the table row.</p>