Q:

Delete a table row with jquery

I'm using this to add a row:
function myFunction4() {
  var table = document.getElementById("myTable");
  var row = table.insertRow(0);
  var cell1 = row.insertCell(0);
  var cell2 = row.insertCell(1); 
  var produs = $( "#produs4" ).val(); 
  var cantitate = $(".cantitate4").val(); 
  var cell3 = row.insertCell(2);
  cell1.innerHTML = produs;
  cell2.innerHTML = cantitate; 
  cell3.innerHTML = " <input type='button' value='X' onclick='SomeDeleteRowFunction(this)'>"
  $(".overlay_cantitate4").fadeOut(500)
}

Then I tried this to delete it but it doesn't work
function SomeDeleteRowFunction() {
  var p = o.parentNode.parentNode;
  p.parentNode.removeChild(p);
}

variables
<select id="produs4"><option selected="selected"> Prajitura cu mar </option></select> 
             <center> <input class="cantitate4 cantitate" type="text" value="1"> 

A:

You can change your delete function put this code in while  you delete 

    function SomeDeleteRowFunction(element) {
      var p = element.parentNode.parentNode;
      p.parentNode.removeChild(p);
    }

